From: Hui Zhu <teawater@gmail.com>
To: Stephen Hemminger <shemminger@vyatta.com>
Cc: "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>,
"WANG Cong" <amwang@redhat.com>, "Arnd Bergmann" <arnd@arndb.de>,
"Arjan van de Ven" <arjan@linux.intel.com>,
"Ozan Ăaglayan" <ozan@pardus.org.tr>,
"Matthew Wilcox" <willy@linux.intel.com>,
"Steven Rostedt" <rostedt@goodmis.org>,
"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 04/10] namespace: perlcritic warnings
Date: Sat, 20 Feb 2010 16:26:24 +0800 [thread overview]
Message-ID: <daef60381002200026g64b09344m51b798315707179d@mail.gmail.com> (raw)
In-Reply-To: <20100219175429.826376846@vyatta.com>
On Sat, Feb 20, 2010 at 01:52, Stephen Hemminger <shemminger@vyatta.com> wrote:> Use local file handle not global.> Make loop and other variables local in scope.>> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>>>> --- a/scripts/namespace.pl 2010-02-19 08:59:00.432184740 -0800> +++ b/scripts/namespace.pl 2010-02-19 09:05:52.672644797 -0800> @@ -175,12 +175,11 @@ sub do_nm> }> if (! -e "$source.c" && ! -e "$source.S") {> # No obvious source, exclude the object if it is conglomerate> - if (! open(OBJDUMPDATA, "$objdump $basename|")) {> - printf STDERR "$objdump $fullname failed $!\n";> - return;> - }> + open(my $objdumpdata, "$objdump $basename|")> + or die "$objdump $fullname failed $!\n";
Looks it just want return, are you sure have to change it to die?
> +> my $comment;> - while (<OBJDUMPDATA>) {> + while (<$objdumpdata>) {> chomp();> if (/^In archive/) {> # Archives are always conglomerate> @@ -190,18 +189,18 @@ sub do_nm> next if (! /^[ 0-9a-f]{5,} /);> $comment .= substr($_, 43);> }> - close(OBJDUMPDATA);> + close($objdumpdata);> +> if (!defined($comment) || $comment !~ /GCC\:.*GCC\:/m) {> printf STDERR "No source file found for $fullname\n";> }> return;> }> - if (! open(NMDATA, "$nm $basename|")) {> - printf STDERR "$nm $fullname failed $!\n";> - return;> - }> + open (my $nmdata, "$nm $basename|")> + or die "$nm $fullname failed $!\n";> +> my @nmdata;> - while (<NMDATA>) {> + while (<$nmdata>) {> chop;> ($type, $name) = (split(/ +/, $_, 3))[1..2];> # Expected types> @@ -268,7 +267,8 @@ sub do_nm> }> }> }> - close(NMDATA);> + close($nmdata);> +> if ($#nmdata < 0) {> if (> $fullname ne "lib/brlock.o"> @@ -316,8 +316,7 @@ sub drop_def>> sub list_multiply_defined> {> - my ($name, $module);> - foreach $name (keys(%def)) {> + foreach my $name (keys(%def)) {> if ($#{$def{$name}} > 0) {> # Special case for cond_syscall> if ($#{$def{$name}} == 1 && $name =~ /^sys_/ &&> @@ -333,8 +332,9 @@ sub list_multiply_defined> &drop_def("arch/x86/kernel/vsyscall-sysenter_32.o", $name);> next;> }> +> printf "$name is multiply defined in :-\n";> - foreach $module (@{$def{$name}}) {> + foreach my $module (@{$def{$name}}) {> printf "\t$module\n";> }> }> @@ -343,12 +343,13 @@ sub list_multiply_defined>> sub resolve_external_references> {> - my ($object, $type, $name, $i, $j, $kstrtab, $ksymtab, $export);> + my ($kstrtab, $ksymtab, $export);> +> printf "\n";> - foreach $object (keys(%nmdata)) {> + foreach my $object (keys(%nmdata)) {> my $nmdata = $nmdata{$object};> - for ($i = 0; $i <= $#{$nmdata}; ++$i) {> - ($type, $name) = split(' ', $nmdata->[$i], 2);> + for (my $i = 0; $i <= $#{$nmdata}; ++$i) {> + my ($type, $name) = split(' ', $nmdata->[$i], 2);> if ($type eq "U" || $type eq "w") {> if (exists($def{$name}) || exists($ksymtab{$name})) {> # add the owning object to the nmdata> @@ -357,7 +358,7 @@ sub resolve_external_references> $kstrtab = "R __kstrtab_$name";> $ksymtab = "R __ksymtab_$name";> $export = 0;> - for ($j = 0; $j <= $#{$nmdata}; ++$j) {> + for (my $j = 0; $j <= $#{$nmdata}; ++$j) {> if ($nmdata->[$j] eq $kstrtab ||> $nmdata->[$j] eq $ksymtab) {> $export = 1;> @@ -424,11 +425,11 @@ sub resolve_external_references> sub list_extra_externals> {> my %noref = ();> - my ($name, @module, $module, $export);> - foreach $name (keys(%def)) {> +> + foreach my $name (keys(%def)) {> if (! exists($ref{$name})) {> - @module = @{$def{$name}};> - foreach $module (@module) {> + my @module = @{$def{$name}};> + foreach my $module (@module) {> if (! exists($noref{$module})) {> $noref{$module} = [];> }> @@ -438,16 +439,16 @@ sub list_extra_externals> }> if (%noref) {> printf "\nExternally defined symbols with no external references\n";> - foreach $module (sort(keys(%noref))) {> + foreach my $module (sort(keys(%noref))) {> printf " $module\n";> foreach (sort(@{$noref{$module}})) {> - if (exists($export{$_})) {> - $export = " (export only)";> - }> - else {> - $export = "";> - }> - printf " $_$export\n";> + my $export;> + if (exists($export{$_})) {> + $export = " (export only)";> + } else {> + $export = "";> + }> + printf " $_$export\n";> }> }> }>> -->>ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2010-02-20 8:33 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20100219175217.385580142@vyatta.com>
[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.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
[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.826376846@vyatta.com>
2010-02-20 3:13 ` [PATCH 04/10] namespace: " Cong Wang
2010-02-20 6:27 ` Stephen Hemminger
2010-02-20 7:35 ` Cong Wang
2010-02-20 8:26 ` Hui Zhu [this message]
2010-02-22 16:41 ` Stephen Hemminger
[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
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=daef60381002200026g64b09344m51b798315707179d@mail.gmail.com \
--to=teawater@gmail.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=shemminger@vyatta.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
all inboxes | Powered by JetHome®