Merge branch 'docs-hash-table-add' into 'master'

ghash: Clarify that g_hash_table_add() always consumes the key

See merge request GNOME/glib!1348
This commit is contained in:
Philip Withnall 2020-01-31 14:24:07 +00:00
commit 84896e558d

View File

@ -1651,12 +1651,16 @@ g_hash_table_replace (GHashTable *hash_table,
/**
* g_hash_table_add:
* @hash_table: a #GHashTable
* @key: a key to insert
* @key: (transfer full): a key to insert
*
* This is a convenience function for using a #GHashTable as a set. It
* is equivalent to calling g_hash_table_replace() with @key as both the
* key and the value.
*
* In particular, this means that if @key already exists in the hash table, then
* the old copy of @key in the hash table is freed and @key replaces it in the
* table.
*
* When a hash table only ever contains keys that have themselves as the
* corresponding value it is able to be stored more efficiently. See
* the discussion in the section description.