lkml.org 
[lkml]   [2010]   [Nov]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] proc: use seq_puts()/seq_putc() where possible
From
Date
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(-)




\
 
 \ /
  Last update: 2010-11-25 08:17    [W:1.967 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site