Wireshark-dev: Re: [Wireshark-dev] Use val_to_str_ext() & friends to access sminmpec_values[]

From: Bill Meier <wmeier@xxxxxxxxxxx>
Date: Fri, 17 Sep 2010 16:36:06 -0400
Jakub Zawadzki wrote:
Hi,

On Fri, Sep 17, 2010 at 02:00:44PM -0400, Bill Meier wrote:
Anders Broman wrote:
Is the script "fixed" to fill out any "holes" in the list with "unasigned"?
That would be the most efficent use...
If I do this, match_strval() against the sminmpec list will no longer return NULL for a "missing" entry (other than "past the end").

Can we use NULLs instead of 'unasigned'?

All value_string_match_t functions (except of _match_strval_linear(), which is just wrapper to match_strval())
are using vs->length already.

It might not work when wireshark want to iterate through values.

I considered using NULL, but came to the conclusion that match_strval_ext doing a linear search could/would terminate early because of the NULL (which is what I think you are saying above).

However: I think you're on the right track: for "extended" value strings I'll just create a version of the linear match which uses vs->length instead of checking for NULL.

I'm also going to change the code slightly so that an extended value_string with one set of contiguous values (ie: starting at any value) will be accessed directly.