[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0612141906270.27378@localhost.localdomain>
Date: Thu, 14 Dec 2006 19:07:27 -0500 (EST)
From: "Robert P. J. Day" <rpjday@...dspring.com>
To: Randy Dunlap <randy.dunlap@...cle.com>
cc: lkml <linux-kernel@...r.kernel.org>, akpm <akpm@...l.org>,
jesper.juhl@...il.com
Subject: Re: [PATCH/RFC] CodingStyle updates
On Thu, 14 Dec 2006, Randy Dunlap wrote:
> David Weinehall wrote:
> > On Thu, Dec 07, 2006 at 12:48:38AM -0800, Randy Dunlap wrote:
> >
> > [snip]
> >
> > > +but no space after unary operators:
> > > + sizeof ++ -- & * + - ~ ! defined
> >
> > Uhm, that doesn't compute... If you don't put a space after sizeof,
> > the program won't compile.
> >
> > int c;
> > printf("%d", sizeofc);
>
> Uh, we prefer not to see "sizeof c". IOW, we prefer to have the
> parentheses use all the time. Maybe I need to say that better?
here's a *really* rough first pass, i'm sure the end result would need
some hand tweaking:
=============================================
#!/bin/sh
DIR=$1
#
# Put in missing parentheses.
#
for f in $(grep -Erl "sizeof [^\(]" ${DIR}) ; do
echo $f
perl -pi -e "s/sizeof ([*]?[A-Za-z0-9_>\[\]\.-]+)( *)/sizeof\(\1\)\2/g" $f
done
#
# Delete possible space between "sizeof" and "(".
#
for f in $(grep -rl "sizeof (" ${DIR}) ; do
perl -pi -e "s/sizeof \(/sizeof\(/g" $f
done
#
# Delete obnoxious spaces inside parentheses.
#
for f in $(grep -rl "sizeof( " ${DIR}) ; do
perl -pi -e "s/sizeof\( *([^ \)]+) *\)/sizeof\(\1\)/g" $f
done
===========================================
rday
-
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