Re: [PATCH 11/15] maint: avoid 'const fooPtr' in conf

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

 



On Tue, Oct 08, 2013 at 11:29:02AM -0600, Eric Blake wrote:
> 'const fooPtr' is the same as 'foo * const' (the pointer won't
> change, but it's contents can).  But in general, if an interface
> is trying to be const-correct, it should be using 'const foo *'
> (the pointer is to data that can't be changed).
> 
> Fix up remaining offenders in src/conf, and their fallout.
> 
> * src/conf/snapshot_conf.h (virDomainSnapshotAssignDef)
> (virDomainSnapshotFindByName): Drop attempt at const.
> * src/conf/interface_conf.h (virInterfaceObjIsActive)
> (virInterfaceDefFormat): Use intended type.
> (virInterfaceFindByMACString, virInterfaceFindByName)
> (virInterfaceAssignDef, virInterfaceRemove): Drop attempt at
> const.
> * src/conf/network_conf.h (virNetworkObjIsActive)
> (virNetworkDefFormat, virNetworkDefForwardIf)
> (virNetworkDefGetIpByIndex, virNetworkIpDefPrefix)
> (virNetworkIpDefNetmask): Use intended type.
> (virNetworkFindByUUID, virNetworkFindByName, virNetworkAssignDef)
> (virNetworkObjAssignDef, virNetworkRemoveInactive)
> (virNetworkBridgeInUse, virNetworkSetBridgeName)
> (virNetworkAllocateBridge): Drop attempt at const.
> * src/conf/netdev_vlan_conf.h (virNetDevVlanFormat): Make
> const-correct.
> * src/conf/node_device_conf.h (virNodeDeviceHasCap)
> (virNodeDeviceDefFormat): Use intended type.
> (virNodeDeviceFindByName, virNodeDeviceFindBySysfsPath)
> (virNodeDeviceAssignDef, virNodeDeviceObjRemove)
> (virNodeDeviceGetParentHost): Drop attempt at const.
> * src/conf/secret_conf.h (virSecretDefFormat): Use intended type.
> * src/conf/snapshot_conf.c (virDomainSnapshotAssignDef)
> (virDomainSnapshotFindByName): Fix fallout.
> * src/conf/interface_conf.c (virInterfaceBridgeDefFormat)
> (virInterfaceBondDefFormat, virInterfaceVlanDefFormat)
> (virInterfaceProtocolDefFormat, virInterfaceDefDevFormat)
> (virInterfaceDefFormat, virInterfaceFindByMACString)
> (virInterfaceFindByName, virInterfaceAssignDef)
> (virInterfaceRemove): Likewise.
> * src/conf/network_conf.c
> (VIR_ENUM_IMPL, virNetworkFindByName, virNetworkObjAssignDef)
> (virNetworkAssignDef, virNetworkRemoveInactive)
> (virNetworkDefGetIpByIndex, virNetworkIpDefPrefix)
> (virNetworkIpDefNetmask, virNetworkDHCPHostDefParseXML)
> (virNetworkIpDefFormat, virNetworkRouteDefFormat)
> (virPortGroupDefFormat, virNetworkForwardNatDefFormat)
> (virNetworkDefFormatInternal, virNetworkBridgeInUse)
> (virNetworkAllocateBridge, virNetworkSetBridgeName)
> (virNetworkDNSDefFormat, virNetworkDefFormat): Likewise.
> * src/conf/netdev_vlan_conf.c (virNetDevVlanFormat): Likewise.
> * src/conf/node_device_conf.c (virNodeDeviceHasCap)
> (virNodeDeviceFindBySysfsPath, virNodeDeviceFindByName)
> (virNodeDeviceAssignDef, virNodeDeviceObjRemove)
> (virNodeDeviceDefFormat, virNodeDeviceGetParentHost): Likewise.
> * src/conf/secret_conf.c (virSecretDefFormatUsage)
> (virSecretDefFormat): Likewise.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  src/conf/interface_conf.c   | 30 +++++++++++++++++-------------
>  src/conf/interface_conf.h   | 15 +++++++--------
>  src/conf/netdev_vlan_conf.c |  4 ++--
>  src/conf/netdev_vlan_conf.h |  4 ++--
>  src/conf/network_conf.c     | 44 ++++++++++++++++++++++----------------------
>  src/conf/network_conf.h     | 28 ++++++++++++++--------------
>  src/conf/node_device_conf.c | 14 +++++++-------
>  src/conf/node_device_conf.h | 14 +++++++-------
>  src/conf/secret_conf.c      |  8 ++++----
>  src/conf/secret_conf.h      |  4 ++--
>  src/conf/snapshot_conf.c    |  6 +++---
>  src/conf/snapshot_conf.h    |  6 +++---
>  12 files changed, 90 insertions(+), 87 deletions(-)

ACK

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]