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).
Regards,
Sebastien Tandel
On Tue, Mar 24, 2009 at 10:28,
list@xxxxxxxxxxxxxxxx <list@xxxxxxxxxxxxxxxx> 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 =
proto_node
...
> > 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.