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

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

From: Guy Harris <guy@xxxxxxxxxx>
Date: Tue, 5 Feb 2002 14:15:38 -0800 (PST)
> The problem can be fixed by changing the definition in value_string.h to:
> 
> 	typedef struct value_string {
>                      ^ without the leading '_'
>       ...
>       } value_string;

It can also, presumably, be fixed by using "struct _value_string" rather
than "struct value_string" in "epan/proto.h"; I assume we had a reason
for using "_value_string" as the structure tag, so I took the latter
approach, and checked that code in.

I've attached a patch with the change I checked in; apply it if you're
not building from CVS.  (If you're building from CVS, just do a checkout
- and make sure it gives you revision 1.27 of "epan/proto.h"; if it
doesn't, wait an hour or so and try again, as changes don't show up
immediately in anonymous CVS.)
Index: epan/proto.h
===================================================================
RCS file: /usr/local/cvsroot/ethereal/epan/proto.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -c -r1.26 -r1.27
*** epan/proto.h	2002/01/04 08:56:11	1.26
--- epan/proto.h	2002/02/05 22:10:20	1.27
***************
*** 42,54 ****
  #include "tvbuff.h"
  #include "ftypes/ftypes.h"
  
! struct value_string;
  
  #define ITEM_LABEL_LENGTH	240
  
  /* In order to make a const value_string[] look like a value_string*, I
   * need this macro */
! #define VALS(x)	(struct value_string*)(x)
  
  /* ... and similarly, */
  #define TFS(x)	(struct true_false_string*)(x)
--- 42,54 ----
  #include "tvbuff.h"
  #include "ftypes/ftypes.h"
  
! struct _value_string;
  
  #define ITEM_LABEL_LENGTH	240
  
  /* In order to make a const value_string[] look like a value_string*, I
   * need this macro */
! #define VALS(x)	(struct _value_string*)(x)
  
  /* ... and similarly, */
  #define TFS(x)	(struct true_false_string*)(x)
***************
*** 187,193 ****
  
  extern int
  proto_register_field(char *name, char *abbrev, enum ftenum type, int parent,
! 	struct value_string* vals);
  
  extern int
  proto_register_protocol(char *name, char *short_name, char *filter_name);
--- 187,193 ----
  
  extern int
  proto_register_field(char *name, char *abbrev, enum ftenum type, int parent,
! 	struct _value_string* vals);
  
  extern int
  proto_register_protocol(char *name, char *short_name, char *filter_name);