From: Bruno Haible Date: Tue, 31 Aug 2010 06:43:53 +0000 (+0200) Subject: hash: silence spurious clang warning X-Git-Tag: v0.1~3875 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=e85049070e2d175e247787ebcc2241b77cb8939f;p=gnulib.git hash: silence spurious clang warning * lib/hash.c (hash_get_next): Remove unnecessary test against NULL. Reported by Eric Blake. --- diff --git a/ChangeLog b/ChangeLog index a7b5e681d..a61bf9f4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-08-30 Bruno Haible + + 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 strstr, memmem, strcasestr: avoid leaked shell message diff --git a/lib/hash.c b/lib/hash.c index 15630be21..225865208 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)