Wireshark-dev: Re: [Wireshark-dev] proto_tree -> proto_item
From: Sébastien Tandel <[email protected]>
Date: Tue, 24 Mar 2009 11:41:21 -0300
ok, my bad. I haven't read proto_tree_get_parent() documentation and was guessing - erroneously - that it was returning a tree ... because a parent of a tree should be a tree and not an item (in the case, one day someone would like to have an API which differentiates proto_item from proto_tree).

Sebastien Tandel

On Tue, Mar 24, 2009 at 10:28, [email protected] <[email protected]> wrote:
Sébastien Tandel wrote:
> I'm not sure it's really safe and cleaner since it's
> working only because proto_item = proto_tree =
> On Mon, Mar 23, 2009 at 18:48, Luca Ceresoli
> <[email protected]> wrote:
> >  my_tree = ptvcursor_add_text_with_subtree(cursor,
> >  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.


Sent via:    Wireshark-dev mailing list <[email protected]>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
            mailto:[email protected]?subject=unsubscribe