From: Josef Weidendorfer Date: Tue, 11 Aug 2009 14:45:03 +0000 (+0000) Subject: Fix bug 199338: callgrind_annotate sorting/thresholds are broken X-Git-Tag: svn/VALGRIND_3_5_0~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f75771cc8fb0e5d2e6a993294b6ce5178a4171b4;p=thirdparty%2Fvalgrind.git Fix bug 199338: callgrind_annotate sorting/thresholds are broken git-svn-id: svn://svn.valgrind.org/valgrind/trunk@10778 --- diff --git a/callgrind/callgrind_annotate.in b/callgrind/callgrind_annotate.in index 0a8c301285..afa9e04bff 100644 --- a/callgrind/callgrind_annotate.in +++ b/callgrind/callgrind_annotate.in @@ -243,17 +243,21 @@ sub process_cmd_line() # --sort=A,B,C } elsif ($arg =~ /^--sort=(.*)$/) { @sort_events = split(/,/, $1); + my $th_specified = 0; foreach my $i (0 .. scalar @sort_events - 1) { - if ($sort_events[$i] =~#/.*:(\d+)$/) { - /.*:([\d\.]+)%?$/) { + if ($sort_events[$i] =~ /.*:([\d\.]+)%?$/) { my $th = $1; ($th >= 0 && $th <= 100) or die($usage); $sort_events[$i] =~ s/:.*//; $thresholds[$i] = $th; + $th_specified = 1; } else { $thresholds[$i] = 0; } } + if (not $th_specified) { + @thresholds = (); + } # --threshold=X (tolerates a trailing '%') } elsif ($arg =~ /^--threshold=([\d\.]+)%?$/) {