forked from osmocom/wireshark
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
This commit is contained in:
parent
28bb3a5591
commit
e2cfb1f173
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue