[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1290669243.11971.256.camel@Joe-Laptop>
Date: Wed, 24 Nov 2010 23:14:03 -0800
From: Joe Perches <joe@...ches.com>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] proc: use seq_puts()/seq_putc() where possible
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(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists