summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kern/hash.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/kern/hash.h b/kern/hash.h
index db399960..666f10da 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;
}