Ethereal-dev: Re: [Ethereal-dev] compare_proto_id taking up 20% of Ethereal's time

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

From: Richard Sharpe <rsharpe@xxxxxxxxxxxxxxxxx>
Date: Sat, 15 Nov 2003 22:45:20 -0800 (PST)
OK,

We seem to be doing some silly things ... while it is useful to keep the 
protocols in a glist, because we need to iterate over them, I don't see 
why we are doing this:

        if (handle->proto_index != -1 &&
            !proto_is_protocol_enabled(handle->proto_index)) {
                /*
                 * The protocol isn't enabled.
                 */
                return 0;
        }

proto_index should be a void * that actually points to an instance of a 
protocol_t. That way we can, in the epan/proto.c routines, simply 
dereference it to get at the fields we need. 

Both proto_is_protocol_enabled and proto_get_protocol_short_name are 
costing us too much time because they call a glib function to walk the 
list of protocols.

Regards
-----
Richard Sharpe, rsharpe[at]ns.aus.com, rsharpe[at]samba.org, 
sharpe[at]ethereal.com, http://www.richardsharpe.com