Re: [PATCH 03/15] maint: avoid 'const fooPtr' in several util files

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

 



On Tue, Oct 08, 2013 at 11:25:00AM -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 offenders in src/util outside of the virnet namespace.
> 
> Also, make a few virSocketAddr functions const-correct, for easier
> conversions in future patches.
> 
> * src/util/virbuffer.h (virBufferError, virBufferUse)
> (virBufferGetIndent): Use intended type.
> * src/util/virmacaddr.h (virMacAddrCmp, virMacAddrCmpRaw)
> (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
> (virMacAddrIsMulticast): Likewise.
> * src/util/virebtables.h (ebtablesAddForwardAllowIn)
> (ebtablesRemoveForwardAllowIn): Likewise.
> * src/util/virsocketaddr.h (virSocketAddrSetIPv4Addr): Drop
> incorrect const.
> (virMacAddrGetRaw, virSocketAddrFormat, virSocketAddrFormatFull):
> Make const-correct.
> (virSocketAddrMask, virSocketAddrMaskByPrefix)
> (virSocketAddrBroadcast, virSocketAddrBroadcastByPrefix)
> (virSocketAddrGetNumNetmaskBits, virSocketAddrGetIpPrefix)
> (virSocketAddrEqual, virSocketAddrIsPrivate)
> (virSocketAddrIsWildcard): Use intended type.
> * src/util/virbuffer.c (virBufferError, virBufferUse)
> (virBufferGetIndent): Fix fallout.
> * src/util/virmacaddr.c (virMacAddrCmp, virMacAddrCmpRaw)
> (virMacAddrSet, virMcAddrFormat, virMacAddrIsUnicast)
> (virMacAddrIsMulticast): Likewise.
> * src/util/virebtables.c (ebtablesAddForwardAllowIn)
> (ebtablesRemoveForwardAllowIn): Likewise.
> * src/util/virsocketaddr.c (virSocketAddrMask, virMacAddrGetRaw)
> (virSocketAddrMaskByPrefix, virSocketAddrBroadcast)
> (virSocketAddrBroadcastByPrefix, virSocketAddrGetNumNetmaskBits)
> (virSocketAddrGetIpPrefix, virSocketAddrEqual)
> (virSocketAddrIsPrivate, virSocketAddrIsWildcard)
> (virSocketAddrGetIPv4Addr, virSocketAddrGetIPv6Addr)
> (virSocketAddrFormat, virSocketAddrFormatFull): Likewise.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  src/util/virbuffer.c     |  8 +++----
>  src/util/virbuffer.h     |  8 +++----
>  src/util/virebtables.c   |  4 ++--
>  src/util/virebtables.h   |  6 +++---
>  src/util/virmacaddr.c    | 16 +++++++-------
>  src/util/virmacaddr.h    | 16 +++++++-------
>  src/util/virsocketaddr.c | 54 +++++++++++++++++++++++++++---------------------
>  src/util/virsocketaddr.h | 52 +++++++++++++++++++++++-----------------------
>  8 files changed, 85 insertions(+), 79 deletions(-)

AKC


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]