Method

GLibHashTableIterremove

since: 2.16

Declaration

void
g_hash_table_iter_remove (
  GHashTableIter* iter
)

Description

Removes the key/value pair currently pointed to by the iterator from its associated GHashTable. Can only be called after g_hash_table_iter_next() returned TRUE, and cannot be called more than once for the same key/value pair.

If the GHashTable was created using g_hash_table_new_full(), the key and value are freed using the supplied destroy functions, otherwise you have to make sure that any dynamically allocated values are freed yourself.

It is safe to continue iterating the GHashTable afterward:

while (g_hash_table_iter_next (&iter, &key, &value))
  {
    if (condition)
      g_hash_table_iter_remove (&iter);
  }

Available since: 2.16