diff options
author | Michael Mann <mmann78@netscape.net> | 2013-10-06 02:07:47 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-10-06 02:07:47 +0000 |
commit | 625fbd5f9a09483485f9c2b0271ab29afb68a597 (patch) | |
tree | dbd30ba6dd0e77af96559084a7502f247567f743 /tools/checkAPIs.pl | |
parent | 7f36cf3092c94a12f3194836c73eff947c1cea01 (diff) |
Allow a "more complex" algorithm to finding proto_tree_add_text overuse. Disabled by default, but used when I want to go on an add filterability spree. convert_proto_tree_add_text.pl makes these easier to fix, so why not be pickier about the percentages that dissectors use.
svn path=/trunk/; revision=52392
Diffstat (limited to 'tools/checkAPIs.pl')
-rwxr-xr-x | tools/checkAPIs.pl | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl index 90da6e1713..7abea4b808 100755 --- a/tools/checkAPIs.pl +++ b/tools/checkAPIs.pl @@ -1376,6 +1376,8 @@ sub checkAddTextCalls($$) my $add_text_count = 0; my $okay_add_text_count = 0; my $add_xxx_count = 0; + my $total_count = 0; + my $aggressive = 0; my $percentage = 100; # The 3 loops here are slow, but trying a single loop with capturing @@ -1399,17 +1401,30 @@ sub checkAddTextCalls($$) $add_xxx_count -= $add_text_count; $add_text_count -= $okay_add_text_count; + $total_count = $add_text_count+$add_xxx_count; + # Don't bother with files with small counts - if (($add_xxx_count < 10 || $add_text_count < 10) && ($add_text_count+$add_xxx_count < 20)) { + if (($add_xxx_count < 10 || $add_text_count < 10) && ($total_count < 20)) { return; } if ($add_xxx_count > 0) { $percentage = 100*$add_text_count/$add_xxx_count; } - if ($percentage > 50) { + + if ($aggressive > 0) { + if ((($total_count <= 50) && ($percentage > 50)) || + (($total_count > 50) && ($total_count <= 100) && ($percentage > 40)) || + (($total_count > 100) && ($total_count <= 200) && ($percentage > 30)) || + (($total_count > 200) && ($percentage > 20))) { + printf "%s: found %d useless add_text() vs. %d add_<something else>() calls (%.2f%%)\n", + $filename, $add_text_count, $add_xxx_count, $percentage; + } + } else { + if ($percentage > 50) { printf "%s: found %d useless add_text() vs. %d add_<something else>() calls (%.2f%%)\n", $filename, $add_text_count, $add_xxx_count, $percentage; + } } } |