[Freeciv-Dev] Re: (PR#12893) [PATCH] improved hash tables
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12893 >
On Tue, Apr 26, 2005 at 05:51:50AM -0700, Vasco Alexandre da Silva Costa wrote:
> I could probably live without the free functions for the scripting
> engine, since I now have hash_lookup. But the free functions are more
> efficient and can make the userland code simpler in other cases.
Great! Every time I use a hash I want to have free functions.
Comments:
(1) hash_free should check h->free_key_fun and h->free_data_func once
before the loop; only loop if one of them is non-null.
(2) breaking constness (data and key are const; but to free them we need
to remove the const quals) is unfortunate; I'm not sure what the most
elegant solution is. This isn't a new problem: hash_replace and
hash_lookup_data return void* rather than const void*.
-- Benoît
|
|