GHashTable improvements



I was looking back at Sven's patches in #50796 to see if
they were ready to commit. The patch adds:

=======
GHashTable* g_hash_table_new_full          (GHashFunc       hash_func,
					    GEqualFunc      key_equal_func,
					    GDestroyNotify  key_destroy_func,
					    GDestroyNotify  value_destroy_func);
void        g_hash_table_destroy_no_notify (GHashTable     *hash_table);
void        g_hash_table_replace           (GHashTable     *hash_table,
					    gpointer        key,
					    gpointer        value);
gboolean    g_hash_table_remove_no_notify  (GHashTable     *hash_table,
					    gconstpointer   key);
=======

The items that may be outstanding here are:

 - In the discussion earlier, there was some idea that g_hash_table_replace()
   wasn't necessary as long as g_hash_table_insert() called the destroy
   notify on the key function.
 
   The main argument for keeping g_hash_table_replace() then seems
   to be that you might have a case where key and value are
   associated:

    g_hash_table_insert (hash, entry->name, entry);
  
   I've done this fairly frequently in the past.

 - Do we need g_hash_table_foreach_remove_no_notify() since
   we have remove_no_notify() and destroy_no_notify()?

 - The name in GObject is not g_object_set_data_notify() as it
   was in GtkObject, but g_object_steal_data(). So perhaps,
   if this is our desired name, we should have
   g_hash_table_steal() g_hash_table_destroy_stealing_all (????)
   g_hash_table_foreach_steal()? 

Other than these items, and the addition of docs, I think it is a useful 
addition, and about ready to commit.

Regards,
                                        Owen


   





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]