diff options
author | Michael Mann <mmann78@netscape.net> | 2013-07-05 14:22:35 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-07-05 14:22:35 +0000 |
commit | e2cfb1f173007c003aa6920e4ac6b843965e63d0 (patch) | |
tree | d3775ab866909c40cd0082123a9ebc6bf3e64572 /tools/checkAPIs.pl | |
parent | 28bb3a559135fa50b74b22ce9fa0ea501151dce0 (diff) |
Make checkAPIs.pl a little more discerning when looking for too many proto_tree_add_text()s. I believe the intent was to ignore "small" dissectors that didn't have enough fields to qualify, but the previous logic ignored dissectors that were (almost) all proto_tree_add_text and no proto_tree_add_xxx.
I'm flexible on the definition of "small" (20 "fields"), but I think checkAPIs should flag the "all proto_tree_add_text" dissectors.
svn path=/trunk/; revision=50385
Diffstat (limited to 'tools/checkAPIs.pl')
-rwxr-xr-x | tools/checkAPIs.pl | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl index 65b643d21a..3925dd97b3 100755 --- a/tools/checkAPIs.pl +++ b/tools/checkAPIs.pl @@ -1311,6 +1311,7 @@ sub checkAddTextCalls($$) my $add_text_count = 0; my $okay_add_text_count = 0; my $add_xxx_count = 0; + my $percentage = 100; # The 3 loops here are slow, but trying a single loop with capturing # parenthesis is even slower! @@ -1334,11 +1335,13 @@ sub checkAddTextCalls($$) $add_text_count -= $okay_add_text_count; # Don't bother with files with small counts - if ($add_xxx_count < 10 || $add_text_count < 10) { + if (($add_xxx_count < 10 || $add_text_count < 10) && ($add_text_count+$add_xxx_count < 20)) { return; } - my $percentage = 100*$add_text_count/$add_xxx_count; + if ($add_xxx_count > 0) { + $percentage = 100*$add_text_count/$add_xxx_count; + } 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; |