Wireshark mailing list archives

Re: proto_tree_add_uint vs. proto_tree_add_item


From: Pascal Quantin <pascal.quantin () gmail com>
Date: Fri, 29 Aug 2014 18:48:02 +0200

Le 29 août 2014 18:33, "Thomas Wiens" <th.wiens () gmx de> a écrit :

Hi,

I've got a comment in the code review, that I can use
proto_tree_add_item instead of proto_tree_add_uint.

I have used proto_tree_add_uint() when the value which is added is
needed for packet dissection (e.g. to decide which path is to follow).

Should I change all of my proto_tree_add_uint() to proto_tree_add_item()?

My thought was, that with proto_tree_add_uint the value has only to be
peeked once out of tvbuff.

--
Regards,
Thomas

Hi Thomas,
I'm often doing the same thing myself: it avoids fetching twice the same
value. That said the overhead must be quite small but personally I consider
your code as correct.

Regards,
Pascal.
___________________________________________________________________________
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: