Messages in this thread | | | Subject | Re: [rfc patch] treewide: Convert "static const char <*> foo[] =" to "static const char <*> const foo[] =" | From | Joe Perches <> | Date | Thu, 09 Sep 2010 11:48:47 -0700 |
| |
On Thu, 2010-09-09 at 14:29 -0400, Mike Frysinger wrote: > On Thu, Sep 9, 2010 at 14:22, Joe Perches wrote: > > To move data to const sections, specify > > that the pointed to strings are also const. > did you find cases where this couldnt be done ?
Nope.
> this is going to keep > creeping back in with new drivers unless we have something like > checkpatch.pl catching it ...
These are added pretty slowly, but both of
static char foo[] = "bar" and static const char *foo[] = {"bar"}
could be warned by checkpatch
> where is the actual patch ?
On my computer. 300KB is pretty big to post. I'll sent it to you separately.
The script was:
search='\bstatic\s+const\s+char\s*\*\s*(\w+)\s*\[\s*\]\s*=\s*' replace='static const char \* const \1\[\] = ' grep -rPl --include=*.[ch] "$search" * | \ while read file ; do \ echo $file ; \ perl -p -i -e "s/$search/$replace/g" $file ;\ done
with some hand cleanups for those functions that needed to be changed to use "const char * const"
| |