From: Joe Perches <joe@perches.com>
To: Alexey Dobriyan <adobriyan@gmail.com>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] proc: use seq_puts()/seq_putc() where possible
Date: Wed, 24 Nov 2010 23:14:03 -0800 [thread overview]
Message-ID: <1290669243.11971.256.camel@Joe-Laptop> (raw)
In-Reply-To: <20101124214058.GA21245@core2.telecom.by>
On Wed, 2010-11-24 at 23:40 +0200, Alexey Dobriyan wrote:
> For string without format specifiers, use seq_puts().
> For seq_printf("\n"), use seq_putc('\n').
>
> text data bss dec hex filename
> 61866 488 112 62466 f402 fs/proc/proc.o
> 61729 488 112 62329 f379 fs/proc/proc.o
> ----------------------------------------------------
> -139
If this is really useful, perhaps it should be done treewide.
Here's a script that does that:
grep -rPl --include=*.[ch] "\bseq_printf\b" * |
xargs perl -p -i \
-e 's/\bseq_printf\s*\(\s*([^,]+),\s*\"([^\%\"]+)\"\s*\)/seq_puts\($1, \"$2\"\)/g'
grep -rPl --include=*.[ch] "\bseq_puts\b" * |
xargs perl -p -i \
-e "s/\bseq_puts\s*\(\s*([^,]+),\s*\"\\\n\"\s*\)/seq_putc\(\$1, '\\\n'\)/g"
grep -rPl --include=*.[ch] "\bseq_puts\b" * |
xargs perl -p -i \
-e "s/\bseq_puts\s*\(\s*([^,]+),\s*\"(.)\"\s*\)/seq_putc\(\$1, '\$2'\)/g"
$ git diff --shortstat
256 files changed, 1119 insertions(+), 1119 deletions(-)
prev parent reply other threads:[~2010-11-25 7:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-24 21:40 Alexey Dobriyan
2010-11-25 7:14 ` Joe Perches [this message]
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=1290669243.11971.256.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
/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®