/** * g_hash_table_insert: * @hash_table: a #GHashTable. * @key: a key to insert. * @value: the value to associate with the key. * * Inserts a new key and value into a #GHashTable. * * If the key already exists in the #GHashTable its current value is replaced * with the new value. If you supplied a @value_destroy_func when creating the * #GHashTable, the old value is freed using that function. If you supplied * a @key_destroy_func when creating the #GHashTable, the passed key is freed * using that function. **/ void g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value) { g_hash_table_insert_internal (hash_table, key, value, FALSE); }
/** * g_hash_table_replace: * @hash_table: a #GHashTable. * @key: a key to insert. * @value: the value to associate with the key. * * Inserts a new key and value into a #GHashTable similar to * g_hash_table_insert(). The difference is that if the key already exists * in the #GHashTable, it gets replaced by the new key. If you supplied a * @value_destroy_func when creating the #GHashTable, the old value is freed * using that function. If you supplied a @key_destroy_func when creating the * #GHashTable, the old key is freed using that function. **/ void g_hash_table_replace (GHashTable *hash_table, gpointer key, gpointer value) { g_hash_table_insert_internal (hash_table, key, value, TRUE); }
gboolean g_hash_table_insert (GHashTable *hash_table, gpointer key, gpointer value) { return g_hash_table_insert_internal (hash_table, key, value, FALSE); }