On Tue, Aug 13, 2013 at 01:12:18PM -0400, Evan Huus wrote:
> Anyone building with a new enough glib will get this behaviour for free? So
> I don't think it's worth backporting to older builds unless the memory
> savings are really significant...
I don't want to backport it, I was thinking about using it.
for example 'registered_dissectors' from packet.c:
Right now we have:
2018 g_hash_table_insert(registered_dissectors, (gpointer)name,
2019 (gpointer) handle);
but name is also accessible by handle
2013 handle->name = name;
so we could do:
g_hash_table_insert(registered_dissectors, handle, handle);
but it'd requires some changes:
- for hash function, g_str_hash() can't be called directly, but new function with just g_str_hash(handle->name)
- for lookup code (find_dissector())
instead of simple:
g_hash_table_lookup(registered_dissectors, name);
we'd need to do:
dissector_handle_t temp;
temp.name = name;
g_hash_table_lookup(registered_dissectors, &temp);
the second part is this 'hacky' thing.