Archives for January, 2013

Why is g_hash_table_insert used?

Yesterday I was discussing a bug in some code using a GHashTable with Will and we both started to wonder if there is any reason to use g_hash_table_insert instead of g_hash_table_replace. First of all an example, look at this code and try to find the bug. #include <glib.h> static void add_entry (GHashTable *ht, const gchar […]