Skip to content

ghash: Clarify that g_hash_table_add() always consumes the key

Philip Withnall requested to merge pwithnall/glib:docs-hash-table-add into master

Even if the key already exists in the table, g_hash_table_add() will call the hash table’s key free func on the old key and will then replace the old key with the newly-passed-in key. So key is always (transfer full).

In particular, key should never need to be freed by the caller if g_hash_table_add() returns FALSE.

Signed-off-by: Philip Withnall withnall@endlessm.com

Merge request reports