+2009-06-18  Eric Blake  <ebb9@byu.net>
+
+       hash: minor optimization
+       * lib/hash.c (hash_lookup, hash_find_entry): Avoid function call
+       when possible.
+       (hash_initialize): Document this promise.
+       (hash_do_for_each, hash_clear, hash_free): Use C89 syntax.
+       * tests/test-hash.c (hash_compare_strings): Test this.
+
 2009-06-18  Bruno Haible  <bruno@clisp.org>
 
        * m4/strstr.m4 (gl_FUNC_STRSTR): Skip linear time test if strstr is
 
     return NULL;
 
   for (cursor = bucket; cursor; cursor = cursor->next)
-    if (table->comparator (entry, cursor->data))
+    if (entry == cursor->data || table->comparator (entry, cursor->data))
       return cursor->data;
 
   return NULL;
        {
          for (cursor = bucket; cursor; cursor = cursor->next)
            {
-             if (!(*processor) (cursor->data, processor_data))
+             if (! processor (cursor->data, processor_data))
                return counter;
              counter++;
            }
    The user-supplied COMPARATOR function should be provided.  It accepts two
    arguments pointing to user data, it then returns true for a pair of entries
    that compare equal, or false otherwise.  This function is internally called
-   on entries which are already known to hash to the same bucket index.
+   on entries which are already known to hash to the same bucket index,
+   but which are distinct pointers.
 
    The user-supplied DATA_FREER function, when not NULL, may be later called
    with the user data as an argument, just before the entry containing the
          for (cursor = bucket->next; cursor; cursor = next)
            {
              if (table->data_freer)
-               (*table->data_freer) (cursor->data);
+               table->data_freer (cursor->data);
              cursor->data = NULL;
 
              next = cursor->next;
 
          /* Free the bucket head.  */
          if (table->data_freer)
-           (*table->data_freer) (bucket->data);
+           table->data_freer (bucket->data);
          bucket->data = NULL;
          bucket->next = NULL;
        }
          if (bucket->data)
            {
              for (cursor = bucket; cursor; cursor = cursor->next)
-               {
-                 (*table->data_freer) (cursor->data);
-               }
+               table->data_freer (cursor->data);
            }
        }
     }
     return NULL;
 
   /* See if the entry is the first in the bucket.  */
-  if ((*table->comparator) (entry, bucket->data))
+  if (entry == bucket->data || table->comparator (entry, bucket->data))
     {
       void *data = bucket->data;
 
   /* Scan the bucket overflow.  */
   for (cursor = bucket; cursor->next; cursor = cursor->next)
     {
-      if ((*table->comparator) (entry, cursor->next->data))
+      if (entry == cursor->next->data
+         || table->comparator (entry, cursor->next->data))
        {
          void *data = cursor->next->data;