GLib.HashTable.replace
Description: Reference for GLib.HashTable.replace

### Function

# GLib HashTablereplace

#### Declaration [src]

    gboolean
    g_hash_table_replace (
      GHashTable* hash_table,
      gpointer key,
      gpointer value
    )

#### Description [src]

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.

Starting from GLib 2.40, this function returns a boolean value to indicate whether the newly added value was already in the hash table or not.

#### Parameters

`hash_table`

  Type: `GHashTable`

  A `GHashTable`.

  The data is owned by the caller of the function.

`key`

  Type: `gpointer`

  A key to insert.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

`value`

  Type: `gpointer`

  The value to associate with the key.

  The argument can be `NULL`.
  The data is owned by the caller of the function.

#### Return value

Type: `gboolean`

`TRUE` if the key did not exist yet.