All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Wolfram Sang <w.sang@pengutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
	rostedt@goodmis.org, w.sang@pengutronix.de, tglx@linutronix.de
Subject: [tip:tracing/core] tracing: Use appropriate perl constructs in recordmcount.pl
Date: Wed, 13 Jan 2010 10:23:55 GMT	[thread overview]
Message-ID: <tip-dfaa9e2c5707b2c217c0121aac796e0fa3051482@git.kernel.org> (raw)
In-Reply-To: <1262724082-9517-1-git-send-email-w.sang@pengutronix.de>

Commit-ID:  dfaa9e2c5707b2c217c0121aac796e0fa3051482
Gitweb:     http://git.kernel.org/tip/dfaa9e2c5707b2c217c0121aac796e0fa3051482
Author:     Wolfram Sang <w.sang@pengutronix.de>
AuthorDate: Tue, 5 Jan 2010 21:41:22 +0100
Committer:  Steven Rostedt <rostedt@goodmis.org>
CommitDate: Wed, 6 Jan 2010 18:08:58 -0500

tracing: Use appropriate perl constructs in recordmcount.pl

Modified recordmcount.pl to use perl constructs that are still
understandable by C hackers that are not perl programmers.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
LKML-Reference: <1262724082-9517-1-git-send-email-w.sang@pengutronix.de>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 scripts/recordmcount.pl |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 5de12c7..545fe71 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -136,13 +136,14 @@ my %text_sections = (
      ".text.unlikely" => 1,
 );
 
-$objdump = "objdump" if ((length $objdump) == 0);
-$objcopy = "objcopy" if ((length $objcopy) == 0);
-$cc = "gcc" if ((length $cc) == 0);
-$ld = "ld" if ((length $ld) == 0);
-$nm = "nm" if ((length $nm) == 0);
-$rm = "rm" if ((length $rm) == 0);
-$mv = "mv" if ((length $mv) == 0);
+# Note: we are nice to C-programmers here, thus we skip the '||='-idiom.
+$objdump = 'objdump' if (!$objdump);
+$objcopy = 'objcopy' if (!$objcopy);
+$cc = 'gcc' if (!$cc);
+$ld = 'ld' if (!$ld);
+$nm = 'nm' if (!$nm);
+$rm = 'rm' if (!$rm);
+$mv = 'mv' if (!$mv);
 
 #print STDERR "running: $P '$arch' '$objdump' '$objcopy' '$cc' '$ld' " .
 #    "'$nm' '$rm' '$mv' '$inputfile'\n";
@@ -194,12 +195,8 @@ sub check_objcopy
     }
 }
 
-if ($arch eq "x86") {
-    if ($bits == 64) {
-	$arch = "x86_64";
-    } else {
-	$arch = "i386";
-    }
+if ($arch eq 'x86') {
+    $arch = ($bits == 64) ? 'x86_64' : 'i386';
 }
 
 #
@@ -476,11 +473,7 @@ while (<IN>) {
 	$read_headers = 0;
 
 	# Only record text sections that we know are safe
-	if (defined($text_sections{$1})) {
-	    $read_function = 1;
-	} else {
-	    $read_function = 0;
-	}
+	$read_function = defined($text_sections{$1});
 	# print out any recorded offsets
 	update_funcs();
 

  reply	other threads:[~2010-01-13 10:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-05 18:27 Minor improvements to recordmount.pl Wolfram Sang
2010-01-05 18:27 ` [PATCH 1/2] tracing/recordmount.pl: optimize offsets-handling Wolfram Sang
2010-01-05 18:27   ` [PATCH 2/2] tracing/recordmount.pl: use apropriate perl-constructs Wolfram Sang
2010-01-05 18:37     ` Steven Rostedt
2010-01-05 19:13       ` Wolfram Sang
2010-01-05 19:24         ` Steven Rostedt
2010-01-05 20:41           ` [PATCH V2] " Wolfram Sang
2010-01-13 10:23             ` tip-bot for Wolfram Sang [this message]
2010-01-05 18:39   ` [PATCH 1/2] tracing/recordmount.pl: optimize offsets-handling Steven Rostedt
2010-01-13 10:23   ` [tip:tracing/core] tracing: optimize recordmcount.pl for offsets-handling tip-bot for Wolfram Sang

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=tip-dfaa9e2c5707b2c217c0121aac796e0fa3051482@git.kernel.org \
    --to=w.sang@pengutronix.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.