Messages in this thread | ![/](/images/icornerl.gif) | | Subject | Re: [PATCH] proc: use seq_puts()/seq_putc() where possible | From | Joe Perches <> | Date | Wed, 24 Nov 2010 23:14:03 -0800 |
| |
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(-)
| ![\](/images/icornerr.gif) |