Wireshark mailing list archives
Re: switching to proto_tree_add_subtree()
From: darkjames-ws () darkjames pl
Date: Wed, 30 Jul 2014 07:30:52 +0200
Hi, On Tue, Jul 29, 2014 at 06:47:53PM -0400, Jeff Morriss wrote:
However, I don't quite understand why for tree!=NULL but not visible, proto_tree_add_text() returns tree. I can see this in the code, we call TRY_TO_FAKE_THIS_ITEM(), which returns the tree itself when it's not visible. But what sense does this make for the caller?I think it's because while proto_trees are allowed to be NULL, we don't want (or the API is not ready for) proto_items to be NULL. (IOW that "return tree" quoted above is (ab)using the fact that a proto_item is a proto_tree.) Does this mean that this code in add_subtree_format() should be setting *tree_item to 'tree' (instead of NULL) here:/* Make sure pi is initialized in case TRY_TO_FAKE_THIS_ITEM bails */ if (tree_item != NULL) *tree_item = NULL;
Wouldn't be it simpler if we just remove 'tree_item' argument? Cause I understand that after change *tree_item is always the same as return value? Regards, Jakub. ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: http://www.wireshark.org/lists/wireshark-dev Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev mailto:wireshark-dev-request () wireshark org?subject=unsubscribe
Current thread:
- switching to proto_tree_add_subtree() Martin Kaiser (Jul 28)
- Re: switching to proto_tree_add_subtree() darkjames-ws (Jul 28)
- Re: switching to proto_tree_add_subtree() Martin Kaiser (Jul 29)
- Re: switching to proto_tree_add_subtree() darkjames-ws (Jul 29)
- Re: switching to proto_tree_add_subtree() darkjames-ws (Jul 29)
- Re: switching to proto_tree_add_subtree() Jeff Morriss (Jul 29)
- Re: switching to proto_tree_add_subtree() Evan Huus (Jul 29)
- Re: switching to proto_tree_add_subtree() darkjames-ws (Jul 29)
- Re: switching to proto_tree_add_subtree() Jeff Morriss (Jul 30)
- Re: switching to proto_tree_add_subtree() darkjames-ws (Jul 30)
- Re: switching to proto_tree_add_subtree() Jeff Morriss (Jul 30)
- Re: switching to proto_tree_add_subtree() Martin Kaiser (Jul 29)
- Re: switching to proto_tree_add_subtree() darkjames-ws (Jul 28)
- <Possible follow-ups>
- Re: switching to proto_tree_add_subtree() mmann78 (Jul 30)