Wireshark-dev: Re: [Wireshark-dev] Equivalency between APIs
Date: Tue, 26 Aug 2014 11:19:18 -0400 (EDT)
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:


        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);

        channel_tree = proto_tree_add_subtree_format(rtps_parameter_tree, tvb, off, 0,
           ett_rtps_locator_filter_channel, &ti_channel, "Channel[%u]", ch);

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