Add a note to the g_str_hash docs
authorMatthias Clasen <mclasen@redhat.com>
Mon, 27 Jul 2015 10:51:17 +0000 (06:51 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Mon, 27 Jul 2015 10:51:17 +0000 (06:51 -0400)
Point out some shortcomings of the djb hash, as found in

https://bugzilla.gnome.org/show_bug.cgi?id=751610

glib/ghash.c

index 5c95c72..7f8e5da 100644 (file)
@@ -1860,6 +1860,10 @@ g_str_equal (gconstpointer v1,
  * It can be passed to g_hash_table_new() as the @hash_func parameter,
  * when using non-%NULL strings as keys in a #GHashTable.
  *
+ * Note that this function may not be a perfect fit for all use cases.
+ * For example, it produces some hash collisions with strings as short
+ * as 2.
+ *
  * Returns: a hash value corresponding to the key
  */
 guint