Re: [PATCH] proc: use seq_puts()/seq_putc() where possible

From: Joe Perches
Date: Thu Nov 25 2010 - 02:14:12 EST


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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/