changeset 2956:4fb873832246

(hash_get_next): Fix a thinko: when ENTRY is the last one in a bucket, advance to the next bucket. From Alexandre Duret-Lutz.
author Jim Meyering <jim@meyering.net>
date Sat, 04 Nov 2000 21:38:55 +0000
parents 9c6769f5396a
children ab062fb6bf94
files lib/hash.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lib/hash.c	Fri Nov 03 08:44:12 2000 +0000
+++ b/lib/hash.c	Sat Nov 04 21:38:55 2000 +0000
@@ -267,7 +267,7 @@
 
 /* Return the user data for the entry following ENTRY, where ENTRY has been
    returned by a previous call to either `hash_get_first' or `hash_get_next'.
-   Return NULL if there is no more entries.  */
+   Return NULL if there are no more entries.  */
 
 void *
 hash_get_next (const Hash_table *table, const void *entry)
@@ -284,7 +284,7 @@
       return cursor->next->data;
 
   /* Find first entry in any subsequent bucket.  */
-  for (; bucket < table->bucket_limit; bucket++)
+  while (++bucket < table->bucket_limit)
     if (bucket->data)
       return bucket->data;