diff options
author | Bruno Haible <bruno@clisp.org> | 2010-08-31 08:43:53 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2010-08-31 08:43:53 +0200 |
commit | e85049070e2d175e247787ebcc2241b77cb8939f (patch) | |
tree | f6f981196bc9841c92e917572b730e57811a8a94 | |
parent | 92486154f51fbed2b418b40aeb9c66ca6cf73f3f (diff) | |
download | gnulib-e85049070e2d175e247787ebcc2241b77cb8939f.tar.gz |
hash: silence spurious clang warning
* lib/hash.c (hash_get_next): Remove unnecessary test against NULL.
Reported by Eric Blake.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/hash.c | 11 |
2 files changed, 14 insertions, 3 deletions
@@ -1,3 +1,9 @@ +2010-08-30 Bruno Haible <bruno@clisp.org> + + hash: silence spurious clang warning + * lib/hash.c (hash_get_next): Remove unnecessary test against NULL. + Reported by Eric Blake. + 2010-08-30 Eric Blake <eblake@redhat.com> strstr, memmem, strcasestr: avoid leaked shell message diff --git a/lib/hash.c b/lib/hash.c index 15630be21e..2258652088 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -307,9 +307,14 @@ hash_get_next (const Hash_table *table, const void *entry) abort (); /* Find next entry in the same bucket. */ - for (cursor = bucket; cursor; cursor = cursor->next) - if (cursor->data == entry && cursor->next) - return cursor->next->data; + cursor = bucket; + do + { + if (cursor->data == entry && cursor->next) + return cursor->next->data; + cursor = cursor->next; + } + while (cursor != NULL); /* Find first entry in any subsequent bucket. */ while (++bucket < table->bucket_limit) |