From: Pavel Charvat Date: Mon, 27 Oct 2008 10:48:28 +0000 (+0100) Subject: Just renamed hash_block()'s `str' parameter to `buf'. X-Git-Tag: holmes-import~236 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e58b2156463441119a13359cdb03c7a4fe521c72;p=libucw.git Just renamed hash_block()'s `str' parameter to `buf'. --- diff --git a/ucw/hashfunc.c b/ucw/hashfunc.c index bfd76cfe..2ea36570 100644 --- a/ucw/hashfunc.c +++ b/ucw/hashfunc.c @@ -97,9 +97,9 @@ hash_string_aligned(const char *str) } inline uns -hash_block_aligned(const byte *str, uns len) +hash_block_aligned(const byte *buf, uns len) { - const uns *u = (const uns *) str; + const uns *u = (const uns *) buf; uns hash = 0; while (len >= sizeof(uns)) { @@ -159,11 +159,11 @@ hash_string(const char *str) } uns -hash_block(const byte *str, uns len) +hash_block(const byte *buf, uns len) { - uns shift = UNALIGNED_PART(str, uns); + uns shift = UNALIGNED_PART(buf, uns); if (!shift) - return hash_block_aligned(str, len); + return hash_block_aligned(buf, len); else { uns hash = 0; @@ -181,7 +181,7 @@ hash_block(const byte *str, uns len) hash = ROL(hash, SHIFT_BITS); if (i >= len) break; - hash ^= str[i] << (shift * 8); + hash ^= buf[i] << (shift * 8); } return hash; } diff --git a/ucw/hashfunc.h b/ucw/hashfunc.h index 7250119a..355acd48 100644 --- a/ucw/hashfunc.h +++ b/ucw/hashfunc.h @@ -18,7 +18,7 @@ /* The following functions need str to be aligned to sizeof(uns). */ uns str_len_aligned(const char *str) PURE; /** Get the string length (not a really useful hash function, but there is no better place for it). The string must be aligned to sizeof(uns). For unaligned see @str_len(). **/ uns hash_string_aligned(const char *str) PURE; /** Hash the string. The string must be aligned to sizeof(uns). For unaligned see @hash_string(). **/ -uns hash_block_aligned(const byte *str, uns len) PURE; /** Hash arbitrary data. They must be aligned to sizeof(uns). For unaligned see @hash_block(). **/ +uns hash_block_aligned(const byte *buf, uns len) PURE; /** Hash arbitrary data. They must be aligned to sizeof(uns). For unaligned see @hash_block(). **/ #ifdef CPU_ALLOW_UNALIGNED #define str_len(str) str_len_aligned(str) @@ -27,7 +27,7 @@ uns hash_block_aligned(const byte *str, uns len) PURE; /** Hash arbitrary data. #else uns str_len(const char *str) PURE; /** Get the string length. If you know it is aligned to sizeof(uns), you can use faster @str_len_aligned(). **/ uns hash_string(const char *str) PURE; /** Hash the string. If it is aligned to sizeof(uns), you can use faster @hash_string_aligned(). **/ -uns hash_block(const byte *str, uns len) PURE; /** Hash arbitrary data. If they are aligned to sizeof(uns), use faster @hash_block_aligned(). **/ +uns hash_block(const byte *buf, uns len) PURE; /** Hash arbitrary data. If they are aligned to sizeof(uns), use faster @hash_block_aligned(). **/ #endif uns hash_string_nocase(const char *str) PURE; /** Hash the string in a case insensitive way. Works only with ASCII characters. **/