diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2010-02-22 15:17:09 -0800 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-03-07 21:19:09 +0100 |
commit | 1f2a144f5ab5e836b5ca8f67bd76b759fa947751 (patch) | |
tree | d7fdc51eed976f4fa005e6ebcf83538b8436900a | |
parent | b59a12258460b3d019918719b1bd2563cf37ad9a (diff) | |
download | linux-1f2a144f5ab5e836b5ca8f67bd76b759fa947751.tar.bz2 |
scripts: improve checkstack
Cleanup checkstack script:
* Turn on strict checking
* Fix resulting error message because the declaration syntax
was incorrect.
* Remove incorrect and misleading use of prototype
- prototype not required for this type of sort function
because $a and $b are being used in this contex
- if prototype was being used it should be for both arguments
* Use closure for sort function
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Cong Wang <amwang@redhat.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
-rwxr-xr-x | scripts/checkstack.pl | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/scripts/checkstack.pl b/scripts/checkstack.pl index 14ee68e991dd..1afff6658a7d 100755 --- a/scripts/checkstack.pl +++ b/scripts/checkstack.pl @@ -21,6 +21,8 @@ # # TODO : Port to all architectures (one regex per arch) +use strict; + # check for arch # # $re is used for two matches: @@ -104,19 +106,11 @@ my (@stack, $re, $dre, $x, $xs); } } -sub bysize($) { - my ($asize, $bsize); - ($asize = $a) =~ s/.*: *(.*)$/$1/; - ($bsize = $b) =~ s/.*: *(.*)$/$1/; - $bsize <=> $asize -} - # # main() # my $funcre = qr/^$x* <(.*)>:$/; -my $func; -my $file, $lastslash; +my ($func, $file, $lastslash); while (my $line = <STDIN>) { if ($line =~ m/$funcre/) { @@ -173,4 +167,6 @@ while (my $line = <STDIN>) { } } -print sort bysize @stack; +# Sort output by size (last field) +print sort { ($b =~ /:\t*(\d+)$/)[0] <=> ($a =~ /:\t*(\d+)$/)[0] } @stack; + |