Ethereal-dev: Re: [Ethereal-dev] Just as an asside...
Date: Thu, 7 Dec 2000 00:28:56 -0800
From: Guy Harris <gharris@xxxxxxxxxxxx>
> On Thu, Dec 07, 2000 at 07:17:03PM +1100, C. L. McAvaney wrote:
> > ...does it matter if you call a proto_tree_add... function if there
> > is no tree?
>
> All the "proto_tree_add" routines should just return NULL and not try to
> add anything to the non-existent protocol tree if handed a null "tree"
> argument. If there are some that don't, that's a bug.
>
> Note that if your dissector creates subtrees, it'd have to do something
> such as
>
> ti = proto_tree_add_whatever(tree, ...);
> if (ti != NULL)
> subtree = proto_item_add_subtree(ti, ett_subtree);
> else
> subtree = NULL;
Is it a "bad" thing to just do that then, and call routines that are going to
return straight away as the tree is null? (i.e. in terms of speed of ethereal)
Christopher
,,,
(. .)
/-----.oOO--(_)--OOo.-------------------------------------------------\
| Christopher McAvaney chrismc@xxxxxxxxxxxxx |
| c.mcavaney@xxxxxxx |
| c.mcavaney@xxxxxxxx |
| phone: +61+3+52272960 c.mcavaney@xxxxxxxxxxxx |
| fax: +61+3+52272028 http://www.cm.deakin.edu.au/~chrismc |
\---------------------------------------------------------------------/