Ethereal-dev: Re: [ethereal-dev] Problem with packet-stat.c

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

From: Nathan Neulinger <nneul@xxxxxxx>
Date: Thu, 18 Nov 1999 22:04:51 -0600
As soon as I find some trace data or can sniff something in progress, 
I'll get rid of that problem and actually fill out the structure. I don't 
see anything against commenting out the whole thing. I'll try and avoid 
doing placeholders like that in the future unless I can put at least one 
(possibly dummy) value into it.

-- Nathan

On Thu, Nov 18, 1999 at 11:56:03AM -0800, Guy Harris wrote:
> > In packet-stat.c, insde proto_register_stat, around line 68-74:
> > 
> >         static hf_register_info hf[] = {
> > #if 0
> >                 { &hf_stat_path, {
> >                         "Path", "stat.path", FT_STRING, BASE_DEC,
> >                         NULL, 0, "Path" }},
> > #endif
> >         };
> > 
> > 
> > What is going on here?
> 
> Some dissectors have "placeholder" arrays of "hf_register_info",
> presumably to serve as a template when the code is changed to use
> registered fields.  I assume that's the intent here.
> 
> > The IBM C compiler apparently doesn't allow you to compile
> > an array initializer with 0 elements, ie. char foo[] = {}; is 
> > a no-no.
> > This causes compilation errors for me.
> 
> Zero-length arrays are a GCC extension; the ANSI C standard does not, as
> far as I know, require compilers to support them.
> 
> I'd vote for doing
> 
> #if 0
>         static hf_register_info hf[] = {
>                 { &hf_stat_path, {
>                         "Path", "stat.path", FT_STRING, BASE_DEC,
>                         NULL, 0, "Path" }},
>         };
> #endif
> 
> and surrounding the "proto_register_field_array()" call with "#if
> 0"/"#endif" as well.
> 
> I'll check in a change to that effect.


------------------------------------------------------------
Nathan Neulinger                       EMail:  nneul@xxxxxxx
University of Missouri - Rolla         Phone: (573) 341-4841
Computing Services                       Fax: (573) 341-4216