Re: [PATCH] qemu: Use 'idx' instead of 'index' for variable name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> >> ---
> >>
> >> 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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]