diff options
author | Richard Braun <rbraun@sceen.net> | 2017-12-18 00:45:19 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-12-18 00:45:19 +0100 |
commit | e527e250a2b2e49da93a355152a35c4a5e80466d (patch) | |
tree | 4e35d8a2389298bac5aeb4d4fef8a7f715684bb1 /kern/hash.h | |
parent | ad764c47c8b183590c06c5ac0be90eea28e4ab13 (diff) |
kern/hash: update from upstream
Diffstat (limited to 'kern/hash.h')
-rw-r--r-- | kern/hash.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/kern/hash.h b/kern/hash.h index db39996..666f10d 100644 --- a/kern/hash.h +++ b/kern/hash.h @@ -41,7 +41,6 @@ #include <assert.h> #include <stdint.h> -#include <string.h> #ifdef __LP64__ #define HASH_ALLBITS 64 @@ -101,7 +100,13 @@ hash_str(const char *str, unsigned int bits) unsigned long hash; char c; - for (hash = 0; (c = *str) != '\0'; str++) { + for (hash = 0; /* no condition */; str++) { + c = *str; + + if (c == '\0') { + break; + } + hash = ((hash << 5) - hash) + c; } |