Wireshark-dev: Re: [Wireshark-dev] proto_tree_add_subtree[_format]
Date: Thu, 10 Jul 2014 10:40:36 -0400
The "not useless" probably fall under 2 categories:
1. Field label with no printf style arguments, usually for a byte array.  Popular ones would be "Data", "Padding" or "Reserved".  I know these aren't filterable, but sometimes I like (understand) how it's displayed (just highlighting bytes) in the tree over how a byte array is displayed (showing all bytes, which can be a bit much for larger byte fields)
2. Label that should really be expert info.

There are still 527 files in the dissector directory that include proto_tree_add_text (simple grep) out of 1649 (which includes header files).  10 remain on the checkAPIs.pl "naughty list" (> 50% proto_tree_add_xxx calls are proto_tree_add_text), and there are 28 remaining if you apply my "aggressive" algorithm (which enforces a lower percentage of proto_tree_add_text calls the more overall proto_tree_add_xxx calls there are, originally aimed at "having subtree labels is okay, but that shouldn't account for that many calls").

Overall I've been working more on the "naughty" ones than dissectors that have only a handful of proto_tree_add_text calls, and perhaps the soft-deprecation will bring more attention/fixes to the dissectors that do only have a few.  Having proto_tree_add_text eradicated before the 2.0 release would be nice (just to say "all fields are filterable"), but probably a bit aggressive.
 
 
 
-----Original Message-----
From: Evan Huus <eapache@xxxxxxxxx>
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Sent: Wed, Jul 9, 2014 11:33 pm
Subject: Re: [Wireshark-dev] proto_tree_add_subtree[_format]

On Wed, Jul 9, 2014 at 10:06 PM, <mmann78@xxxxxxxxxxxx> wrote:
I finished the conversion of proto_tree_add_text calls that were acting as "subtree labels" into proto_tree_add_subtree[_format].  This removed almost 4000 calls in the dissector directory (over 4000 if you include the plugins) and brings the current total proto_tree_add_text count in the dissector directory to 5831 (6586 over entire wireshark master trunk).  Of the 5831, checkAPIs.pl considers 4690 to be "useless". (I believe the criteria being using printf style arguments and no return value (like when it's intended as a subtree label)).

What about the last ~1000 "not useless" ones? How are they used?
 
Since "subtree label" is the last "legimate" reason to use proto_tree_add_text, should it be added as a "soft-deprecated API" to checkAPIs script?

If there really are no remaining legitimate uses, then +1.
 
I wasn't sure if that was just being too obnoxious at the moment.  It may need its own "paragraph" with suggestions on what to use instead (make field filterable, expert info, subtree label)

Obnoxious would be hard-deprecated :)

How many actual c-files are those remaining add_text elements in? I imagine the majority of dissectors are now completely "clean" so it wouldn't be too bad.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@xxxxxxxxxxxxx?subject=unsubscribe