Wireshark-dev: Re: [Wireshark-dev] proto_tree -> proto_item
Date: Tue, 24 Mar 2009 14:28:14 +0100
Sébastien Tandel wrote:
> I'm not sure it's really safe and cleaner since it's
> working only because proto_item = proto_tree =
proto_node
...
> On Mon, Mar 23, 2009 at 18:48, Luca Ceresoli
> <[email protected]> wrote:
> >  my_tree = ptvcursor_add_text_with_subtree(cursor,
..,"foo");
> >  my_item = proto_tree_get_parent(my_tree);
> >  /* ... */
> >  proto_item_set_text(my_item, "<%s>", my_string);

Not sure I got your point.
In proto.h, proto_tree_get_parent() is declared as taking a
proto_tree* and returning a proto_item*, so I interpret it
this way:
  proto_tree* X -> proto_item* Y -> proto_tree* Z
  then proto_tree_get_parent(Z) returns Y.
Where am I wrong?

Of course I am speaking from the "theoretical" and
future-compatible POV.
In the current practice the implementation of
proto_tree_get_parent() is pretty eloquent.

Luca