lkml.org 
[lkml]   [2010]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [rfc patch] treewide: Convert "static const char <*> foo[] =" to "static const char <*> const foo[] ="
From
Date
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"



\
 
 \ /
  Last update: 2010-09-09 20:51    [W:2.129 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site