+2003-02-16 Alexander Larsson <alexl@redhat.com>
+
+ * dbus/dbus-hash.c (_dbus_hash_table_unref):
+ Actually free keys and values when destroying hashtable.
+
2003-02-16 Anders Carlsson <andersca@codefactory.se>
* dbus/dbus-auth.c: (client_try_next_mechanism):
DBusHashEntry *entry);
static void free_entry (DBusHashTable *table,
DBusHashEntry *entry);
+static void free_entry_data (DBusHashTable *table,
+ DBusHashEntry *entry);
/** @} */
}
}
#else
+ DBusHashEntry *entry;
+ int i;
+
+ /* Free the entries in the table. */
+ for (i = 0; i < table->n_buckets; i++)
+ {
+ entry = table->buckets[i];
+ while (entry != NULL)
+ {
+ free_entry_data (table, entry);
+
+ entry = entry->next;
+ }
+ }
/* We can do this very quickly with memory pools ;-) */
_dbus_mem_pool_free (table->entry_pool);
#endif
}
static void
-free_entry (DBusHashTable *table,
- DBusHashEntry *entry)
+free_entry_data (DBusHashTable *table,
+ DBusHashEntry *entry)
{
if (table->free_key_function)
(* table->free_key_function) (entry->key);
if (table->free_value_function)
(* table->free_value_function) (entry->value);
-
+}
+
+static void
+free_entry (DBusHashTable *table,
+ DBusHashEntry *entry)
+{
+ free_entry_data (table, entry);
_dbus_mem_pool_dealloc (table->entry_pool, entry);
}