Function

GLibHashTablesteal_extended

since: 2.58

Declaration [src]

gboolean
g_hash_table_steal_extended (
  GHashTable* hash_table,
  gconstpointer lookup_key,
  gpointer* stolen_key,
  gpointer* stolen_value
)

Description [src]

Looks up a key in the GHashTable, stealing the original key and the associated value and returning TRUE if the key was found. If the key was not found, FALSE is returned.

If found, the stolen key and value are removed from the hash table without calling the key and value destroy functions, and ownership is transferred to the caller of this method, as with g_hash_table_steal(). That is the case regardless whether stolen_key or stolen_value output parameters are requested.

You can pass NULL for lookup_key, provided the hash and equal functions of hash_table are NULL-safe.

The dictionary implementation optimizes for having all values identical to their keys, for example by using g_hash_table_add(). Before 2.82, when stealing both the key and the value from such a dictionary, the value was NULL. Since 2.82, the returned value and key will be the same.

Available since: 2.58

Parameters

hash_table

Type: GHashTable

A GHashTable.

The data is owned by the caller of the function.
lookup_key

Type: gconstpointer

The key to look up.

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

Type: gpointer*

Return location for the original key.

The argument will be set by the function.
The argument can be NULL.
stolen_value

Type: gpointer*

Return location for the value associated with the key.

The argument will be set by the function.
The argument can be NULL.

Return value

Type: gboolean

TRUE if the key was found in the GHashTable.