[libvirt] [PATCH] qemu: Use 'idx' instead of 'index' for variable name
Daniel P. Berrange
berrange at redhat.com
Tue Apr 14 11:24:29 UTC 2015
On Tue, Apr 14, 2015 at 07:19:17AM -0400, John Ferlan wrote:
>
>
> On 04/14/2015 06:51 AM, Daniel P. Berrange wrote:
> > On Tue, Apr 14, 2015 at 06:45:48AM -0400, John Ferlan wrote:
> >> Apparently for Xen-devel 'index' is a global and causes a build failure,
> >> so just use the shortened 'idx' instead to avoid the conflict.
> >>
> >> Signed-off-by: John Ferlan <jferlan at redhat.com>
> >> ---
> >>
> >> I did try modify cfg.mk to add a syntax check similar to the ii,jj,kk
> >> checks, but it tripped up over 'index' declarations inside structures.
> >> I'd be happy to add one, but I need some help formatting it... Here's
> >> what I had:
> >>
> >> sc_prohibit_int_index:
> >> @prohibit='\<(int|unsigned) ([^(=]* )*(index)\>(\s|,|;)' \
> >> halt='use different name than 'index' for declaration' \
> >> $(_sc_search_regexp)
> >
> > We could just rename the fields in the structs too - wouldn't be the
> > end of the world to use idx in those too just to simplify our life.
> >
> > ACK to your immediate fix now anyway.
> >
> > Regards,
> > Daniel
> >
>
> I thought of that too, but it picked up a few comments too
>
> ...
> src/libvirt-domain.c:11105: * "block.<num>.backingIndex" - unsigned int
> giving the <backingStore> index,
> ...
> src/util/virnetdev.c:870: * @ifindex: Pointer to int where the index
> will be written into
How about changing the regex to
(int|unsigned)\s*\*?index
That'd probably have less false positives and still catch the common
cases well enough
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list