[libvirt] [PATCH 1/1] includes: function parameter names same in headers

Daniel P. Berrangé berrange at redhat.com
Tue Feb 13 09:42:29 UTC 2018


On Mon, Feb 12, 2018 at 06:35:45PM +0000, Daniel P. Berrangé wrote:
> On Mon, Feb 12, 2018 at 12:20:55PM -0600, Chris Venteicher wrote:
> > Headers use same function parameter names as definition code.
> > ---
> >  include/libvirt/libvirt-domain.h    | 26 +++++++++++++-------------
> >  include/libvirt/libvirt-event.h     |  4 ++--
> >  include/libvirt/libvirt-host.h      |  4 ++--
> >  include/libvirt/libvirt-interface.h |  4 ++--
> >  include/libvirt/libvirt-network.h   |  6 +++---
> >  include/libvirt/libvirt-nwfilter.h  |  2 +-
> >  include/libvirt/libvirt-qemu.h      |  2 +-
> >  include/libvirt/libvirt-secret.h    |  4 ++--
> >  include/libvirt/libvirt-storage.h   | 12 ++++++------
> >  include/libvirt/libvirt-stream.h    | 22 +++++++++++-----------
> >  10 files changed, 43 insertions(+), 43 deletions(-)
> > 
> > diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h
> > index 4048acf38..60ec35d87 100644
> > --- a/include/libvirt/libvirt-domain.h
> > +++ b/include/libvirt/libvirt-domain.h
> 
> > @@ -1161,11 +1161,11 @@ int                     virDomainFree           (virDomainPtr domain);
> >   */
> >  int                     virDomainSuspend        (virDomainPtr domain);
> >  int                     virDomainResume         (virDomainPtr domain);
> > -int                     virDomainPMSuspendForDuration (virDomainPtr domain,
> > +int                     virDomainPMSuspendForDuration (virDomainPtr dom,
> 
> This changes domain -> dom , but then....
> 
> >
> > -int                     virDomainSetInterfaceParameters (virDomainPtr dom,
> > +int                     virDomainSetInterfaceParameters (virDomainPtr domain,
> 
> This changes dom -> domain.
> 
> IMHO this is no better than we started with.  We should aim for consistency
> naming, so rather than only changing the .h, we should change .c and .h
> to match preferred naming.

For that matter, we should add a custom  syntx-check rule to cfg.mak to
validate the variable naming for various data types. ie validate that
virDomainPtr is always "dom", not "domain".  virNetworkPtr is "net"
not "network", etc

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




More information about the libvir-list mailing list