Ethereal-dev: Re: [Ethereal-dev] MAX_VAR_LEN in prefs.h

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

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 10 Sep 2003 16:49:12 -0700

On Sep 10, 2003, at 4:15 PM, Ian Schorr wrote:

Why is MAX_VAR_LEN in prefs.h set to 48? Is there any reason why it can't be set to a larger number, say 256?

(I'm guessing this had something to do with a platform limitation of some kind?)

The platform on which Ethereal's running knows nothing about Ethereal preference files, and there are auto char arrays in Ethereal longer than 48 characters (i.e., it's not as if there's some platform that limits those arrays to 48 bytes or less), so that's not it.

It was originally 32, probably because that was a power of 2 considered sufficiently large for preference names, and was boosted to 48 in revision 1.28 of prefs.c (it was only recently put in prefs.h, and nothing outside of prefs.c uses it, so I'm going to move it back to prefs.c), because 32 was too short for "gui.protocol_tree_expander_style" if it includes the trailing '\0' - why 48? Why not?

If somebody says they *want* a preference variable with a 256-character name, I'm tempted to ask "why?" - "ip.treat_the_type_of_service_field_as_if_it_were_a_differentiated_servi ces_field_as_specified_in_rfc_2474_and_so_on_rather_than_as_the_type_of_ service_field_as_specified_in_rfc_791" seems a bit excessive.