Re: GHashTable suggestions


I have uploaded two patches to


  This patch adds a new function g_hash_table_new_full() which takes
  two GFreeFunctions as additional parameters. A hash table constructed
  this way will call this functions to destroy the memory allocated for
  the key and value when removing an item from the GHashTable.

  Addtionally there is a new function g_hash_table_remove_no_notify()
  which does not call the destruction functions. Eventually there
  should also be an equivalent g_hash_table_foreach_remove_no_notify()
  which should be trivial to add.

  The only problem I see is that inserting a new item into a GHashTable
  does replace the value (and destroys it if a destroy_func was given),
  but keeps the old key in place. This problem is longstanding, but 
  should probably be handled differently when a key_destroy_func is 
  specified ?!


  This patch adds a new function g_tree_lookup_extended() which works
  just like g_hash_table_lookup_extended(). This function is IMHO 
  absolutely necessary since there is at the moment no way to retrieve
  the memory location of a key in a GTree which makes it extremely 
  difficult to use without leaking memory.

Please have a look at these patches, apply them if you like them 
(they are against current CVS) or let me know what changes you'd like.
If you give me your OK, I can also apply them myself.

Salut, Sven

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