public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: rostedt@goodmis.org
Cc: "Arjan van de Ven" <arjan@linux.intel.com>,
	"Cong Wang" <amwang@redhat.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Luis R. Rodriguez" <lrodriguez@atheros.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"Vegard Nossum" <vegard.nossum@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Robert P. J. Day" <rpjday@crashcourse.ca>,
	"Arnd Bergmann" <arnd@arndb.de>, "Hui Zhu" <teawater@gmail.com>,
	"Ozan Ãaglayan" <ozan@pardus.org.tr>,
	"Matthew Wilcox" <willy@linux.intel.com>,
	"Li Hong" <lihong.hi@gmail.com>, "Ingo Molnar" <mingo@elte.hu>,
	"Ralf Baechle" <ralf@linux-mips.org>,
	"Matt Fleming" <matt@console-pimps.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] scripts: improve checkstack
Date: Mon, 22 Feb 2010 10:22:29 -0800	[thread overview]
Message-ID: <20100222102229.78e3c0e2@nehalam> (raw)
In-Reply-To: <1266861540.24271.4609.camel@gandalf.stny.rr.com>

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>


--- a/scripts/checkstack.pl	2010-02-22 10:15:08.120323236 -0800
+++ b/scripts/checkstack.pl	2010-02-22 10:17:49.878421919 -0800
@@ -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;
+

  reply	other threads:[~2010-02-22 18:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20100219175217.385580142@vyatta.com>
     [not found] ` <20100219175429.611463369@vyatta.com>
2010-02-20  3:04   ` [PATCH 01/10] checkstack: fix perlcritic warnings Cong Wang
2010-02-20  6:25     ` [PATCH] scripts: improve checkstack Stephen Hemminger
2010-02-20  7:35       ` Cong Wang
2010-02-22 16:43         ` Stephen Hemminger
2010-02-22 16:58           ` Arjan van de Ven
2010-02-22 17:59             ` Steven Rostedt
2010-02-22 18:22               ` Stephen Hemminger [this message]
     [not found] ` <20100219175429.683903905@vyatta.com>
2010-02-20  3:05   ` [PATCH 02/10] checkincludes: fix perlcritic warnings Cong Wang
2010-02-20  6:05     ` Stephen Hemminger
2010-02-20  7:30       ` Cong Wang
     [not found] ` <20100219175429.756761745@vyatta.com>
2010-02-19 18:19   ` [PATCH 03/10] Subject checkversion: perl cleanup Ralf Baechle
2010-02-20  3:07   ` Cong Wang
     [not found] ` <20100219175429.897113117@vyatta.com>
2010-02-20  3:14   ` [PATCH 05/10] profile2linkerlist: fix perl warnings Cong Wang
     [not found] ` <20100219175429.969182010@vyatta.com>
2010-02-20  3:23   ` [PATCH 06/10] export_report: " Cong Wang
     [not found] ` <20100219175430.039442417@vyatta.com>
2010-02-20  3:26   ` [PATCH 07/10] headers_check: " Cong Wang
     [not found] ` <20100219175430.107836066@vyatta.com>
2010-02-20  3:29   ` [PATCH 08/10] headers_install: use local file handles Cong Wang
     [not found] ` <20100219175430.177001887@vyatta.com>
2010-02-20  3:31   ` [PATCH 09/10] markup_oops: fix perlcritic warnings Cong Wang
     [not found] ` <20100219175430.246644080@vyatta.com>
2010-02-20  3:33   ` [PATCH 10/10] headerdep: perlcritic warning Cong Wang
     [not found] ` <20100219175429.826376846@vyatta.com>
2010-02-20  3:13   ` [PATCH 04/10] namespace: perlcritic warnings Cong Wang
2010-02-20  6:27     ` Stephen Hemminger
2010-02-20  7:35       ` Cong Wang
2010-02-20  8:26   ` Hui Zhu
2010-02-22 16:41     ` Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100222102229.78e3c0e2@nehalam \
    --to=shemminger@vyatta.com \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=arjan@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=lihong.hi@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=matt@console-pimps.org \
    --cc=mingo@elte.hu \
    --cc=ozan@pardus.org.tr \
    --cc=ralf@linux-mips.org \
    --cc=rostedt@goodmis.org \
    --cc=rpjday@crashcourse.ca \
    --cc=sam@ravnborg.org \
    --cc=teawater@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=vegard.nossum@gmail.com \
    --cc=willy@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox