Not worth it in my opinion unless the memory savings are significant (I
suspect they are only in the range of a few-hundred KB).


On Tue, Aug 13, 2013 at 1:35 PM, Jakub Zawadzki
<darkjames...@darkjames.pl>wrote:

> 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.
> ___________________________________________________________________________
> Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
> Archives:    http://www.wireshark.org/lists/wireshark-dev
> Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
>              mailto:wireshark-dev-requ...@wireshark.org
> ?subject=unsubscribe
>
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@wireshark.org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-requ...@wireshark.org?subject=unsubscribe

Reply via email to