summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2010-08-31 08:43:53 +0200
committerJim Meyering <meyering@redhat.com>2010-08-31 08:43:53 +0200
commite85049070e2d175e247787ebcc2241b77cb8939f (patch)
treef6f981196bc9841c92e917572b730e57811a8a94
parent92486154f51fbed2b418b40aeb9c66ca6cf73f3f (diff)
downloadgnulib-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--ChangeLog6
-rw-r--r--lib/hash.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index a7b5e681da..a61bf9f4dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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)