Yes it's true assuming "ti_channel" isn't otherwise used.
-----Original Message-----
From: Juan Jose Martin Carrascosa <[email protected]>
To: Developer support list for Wireshark <[email protected]>
Sent: Tue, Aug 26, 2014 11:32 am
Subject: Re: [Wireshark-dev] Equivalency between APIs
Thanks for your reply. Regarding the last comment, just to double check since I
am not very experienced on this... it would be like:
channel_tree = proto_tree_add_subtree_format(rtps_parameter_tree, tvb, off, 0,
ett_rtps_locator_filter_channel, NULL, "Channel[%u]", ch);
True?
- Juanjo
On Tue, Aug 26, 2014 at 5:19 PM, <[email protected]> wrote:
You are correct. proto_tree_add_subtree is for no printf-style arguments,
proto_tree_add_subtree_format is for when you need printf-style arguments for
your subtree.
One thing to check (if you're compiler doesn't do it for you because somebody's
will) is that you may no longer need the proto_item* passed into
proto_tree_add_subtree[_format].
Many dissectors had
ti = proto_tree_add_text(....)
subtree = proto_item_add_subtree(ti, ett)
and never referenced ti again. So when that's converted to
proto_tree_add_subtree, you can just pass NULL in for the proto_item* parameter.
-----Original Message-----
From: Juan Jose Martin Carrascosa <[email protected]>
To: Developer support list for Wireshark <[email protected]>
Sent: Tue, Aug 26, 2014 9:43 am
Subject: [Wireshark-dev] Equivalency between APIs
Hi all,
I need to remove the proto_tree_add_text calls, and I wanted to know if this is
equivalent:
Before:
ti_channel = proto_tree_add_text(rtps_parameter_tree, tvb, off, 0,
"Channel[%u]", ch);
channel_tree = proto_item_add_subtree(ti_channel,
ett_rtps_locator_filter_channel);
Now:
channel_tree = proto_tree_add_subtree_format(rtps_parameter_tree, tvb,
off, 0,
ett_rtps_locator_filter_channel, &ti_channel, "Channel[%u]", ch);
Thanks!
Juanjo
___________________________________________________________________________
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
___________________________________________________________________________
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
___________________________________________________________________________
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
___________________________________________________________________________
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