Ethereal-dev: Re: [Ethereal-dev] Re: value_string

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Guy Harris <gharris@xxxxxxxxx>
Date: Mon, 29 Aug 2005 08:53:58 -0700
ronnie sahlberg wrote:

What someone should implement (ill do it next week or so unless
someone else wants to give it a try) to optimize access speed and the
cost of val_to_str()   is to change
val_to_str() to
1, When we find an entry in a value_string   keep track of the index
into the array in a variable cnt.
2, Swap the entry at cnt (the one we found) with the entry cnt>>1 (IFF cnt!=cnt>>1).

...after de-constifying all the value_string tables; otherwise, modifying the table will get an access failure.