GHash: introduce a "set" mode
authorMatthias Clasen <mclasen@redhat.com>
Sun, 1 May 2011 02:28:34 +0000 (22:28 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 1 May 2011 03:11:18 +0000 (23:11 -0400)
commitbe991170fa99185b7cf1dbf3f9bc62c9d656a08a
tree9a3c157b677da6243176caef8fd544f8e382ad7c
parent0ae6bc3aaa57eb15826d81d2db466c166d0b75bf
GHash: introduce a "set" mode

Make hash tables start out in a mode in which they don't store
values at all, until the first insertion of a non-identical
key-value pair.

This reduces memory requirements by 1/3 when using hash tables
to store sets.

Based on a patch by Morten Welinder,
https://bugzilla.gnome.org/show_bug.cgi?id=644437
glib/ghash.c
glib/tests/hash.c