Ethereal-dev: RE: [Ethereal-dev] README.developer - if (tree)

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

From: Biot Olivier <Olivier.Biot@xxxxxxxxxxx>
Date: Tue, 16 Dec 2003 23:52:16 +0100
| -----Original Message-----
| From: Guy Harris
| 
| On Dec 16, 2003, at 2:12 PM, Devin Heitmueller wrote:
| 
| > How about this -- can we replace the function 
| proto_tree_add_X() with a
| > macro that checks to see if the first argument is non-null?
| 
| Yes, as long as "proto_tree_add_X" doesn't take a variable number
| of arguments.  (C89 doesn't support macros that take a variable 
| number of arguments.)

Unless you use double parentheses, like in:

#define IF_proto_tree_add_string(tree, x) \
if (tree) proto_tree_add_string x

You'll have to write:

IF_proto_tree_add_string(my_tree, (my_tree, hf_name,
		tvb, start, len, "%s = %u",
		s_name, index));

Regards,

Olivier