summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hash.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/hash.h b/hash.h
index 1ef1fbe..fc80b79 100644
--- a/hash.h
+++ b/hash.h
@@ -108,7 +108,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;
}