Wireshark mailing list archives

proto_tree_add_*_format* cleanup: script needed :)


From: Jakub Zawadzki <darkjames-ws () darkjames pl>
Date: Tue, 19 Jun 2012 20:28:10 +0200

Hi list,

We have tons of proto_tree_add_*_format() calls where format string starts with hf_name.

Code like:
  tf = proto_tree_add_uint_format(ip_tree, hf_ip_len, tvb, offset + 2, 2, iph->ip_len, "Total length: ...);
can be replaced with:
  tf = proto_tree_add_uint_format_value(ip_tree, hf_ip_len, tvb, offset + 2, 2, iph->ip_len, ...);

To make thing harder, it'd be best if we don't change it when there's no bitmask in hfinfo.


In next step we could also replace code where proto_tree_add_*_format_value() is exactly the same as standard 
representation, like:
  proto_tree_add_uint_format_value(field_tree, hf_tcp_proc_dst_uid, tvb, 0, 0, tcpd->fwd->process_uid, "%u", 
tcpd->fwd->process_uid);
to simpler:
  proto_tree_add_uint(field_tree, hf_tcp_proc_dst_uid, tvb, 0, 0, tcpd->fwd->process_uid);


I wonder if we have some perl hackers, who could write such scripts.
___________________________________________________________________________
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: