Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Status of Emem Removal

From: Evan Huus <eapache@xxxxxxxxx>
Date: Sun, 18 Jan 2015 22:11:36 -0500
As of commit e333e4c90f0aca41b0a56cef22fd80d0b0e73e14 by Michael this
evening, the deprecated 'emem' API has exactly one remaining usage in
the wireshark core codebase, which is a pretty huge accomplishment
considering how widespread it was a few years ago. Big thanks to
Michael and everybody else who have been slowly chipping away at this
problem.

Of course, "one remaining use" is not enough for me - I would love to
have it entirely removed for the 2.0 release! Unfortunately, the
remaining use is a bit of a sticky one because it has so many diverse
callers: val_to_str and friends (val_to_str_ext, etc). A quick scan
with cscope shows that val_to_str alone (not counting any of the
related functions) has over 2000 call sites in Wireshark master right
now.

Our plan of attack for converting other similar functions has been to
add a wmem_scope_t* parameter to them, and then go through each call
site, passing in wmem_packet_scope() where it is actually appropriate,
and refactoring or reworking the code where it isn't (often passing in
NULL and then manually freeing the result). Doing this process for the
2000+ calls to val_to_str would be... tedious, so I'm open to other
suggestions.

Since it appears that the vast majority of such calls can legitimately
use wmem_packet_scope, my current thought is to hard-code
wmem_packet_scope in the existing API, and then for the remaining
cases either:
- add an otherwise-identical API that takes a wmem_scope
or
- convert them to use try_val_to_str and manually handle the "not
found" case as appropriate

Regardless it's going to be a bit of work: there are around 100 calls
in the ui/ directory alone that will have to be tweaked one way or
another.

Thoughts? Suggestions?

Evan