diff options
author | Richard Braun <rbraun@sceen.net> | 2017-12-18 00:37:08 +0100 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-12-18 00:37:08 +0100 |
commit | a0568115cdc9e6aa14820c5553f45f6ec701fb0c (patch) | |
tree | 8205ebae02a5e7135ef3a4c9710b18fc19ac6355 | |
parent | d6176a972708c34ed06a644c07b19a4bd0eae37c (diff) |
hash: fix side effect in condition
-rw-r--r-- | hash.h | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; } |