Re: [PATCH 06/15] maint: avoid 'const fooPtr' in nwfilter files

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

 



On Tue, Oct 08, 2013 at 11:25:03AM -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 nwfilter code.
> 
> This patch does nothing about the stupidity evident in having
> __virNWFilterInstantiateFilter, _virNWFilterInstantiateFilter,
> and virNWFilterInstantiateFilter, which differ only by leading
> underscores, and which infringes on the namespace reserved to
> the implementation - that would need to be a separate cleanup.
> 
> * src/nwfilter/nwfilter_dhcpsnoop.h (virNWFilterDHCPSnoopReq): Use
> intended type.
> * src/nwfilter/nwfilter_gentech_driver.h
> (virNWFilterInstantiateFilter)
> (virNWFilterUpdateInstantiateFilter)
> (virNWFilterInstantiataeFilterLate, virNWFilterTeardownFilter)
> (virNWFilterCreateVarHashmap): Likewise.
> * src/nwfilter/nwfilter_learnipaddr.h (virNWFilterLearnIPAddress):
> Likewise.
> * src/conf/nwfilter_conf.h (virNWFilterApplyBasicRules)
> (virNWFilterApplyDHCPOnlyRules): Likewise.
> (virNWFilterDefFormat): Make const-correct.
> * src/conf/nwfilter_params.h (virNWFilterVarValueCopy)
> (virNWFilterVarValueGetSimple, virNWFilterVarValueGetCardinality)
> (virNWFilterVarValueEqual, virNWFilterVarAccessEqual)
> (virNWFilterVarAccessGetVarName, virNWFilterVarAccessGetType)
> (virNWFilterVarAccessGetIterId, virNWFilterVarAccessGetIndex)
> (virNWFilterVarAccessIsAvailable)
> (virNWFilterVarCombIterGetVarValue): Use intended type.
> (virNWFilterVarValueGetNthValue): Make const-correct.
> * src/nwfilter/nwfilter_dhcpsnoop.c (virNWFilterSnoopReqLeaseDel)
> (virNWFilterSnoopIFKeyFMT, virNWFilterDHCPSnoopReq)
> (virNWFilterSnoopPruneIter, virNWFilterSnoopRemAllReqIter)
> (virNWFilterDHCPSnoopReq): Fix fallout.
> * src/nwfilter/nwfilter_gentech_driver.c
> (virNWFilterVarHashmapAddStdValues, virNWFilterCreateVarHashmap)
> (virNWFilterInstantiate, __virNWFilterInstantiateFilter)
> (_virNWFilterInstantiateFilter, virNWFilterInstantiateFilterLate)
> (virNWFilterInstantiateFilter)
> (virNWFilterUpdateInstantiateFilter)
> (virNWFilterRollbackUpdateFilter, virNWFilterTeardownFilter):
> Likewise.
> * src/nwfilter/nwfilter_learnipaddr.c (virNWFilterLearnIPAddress):
> Likewise.
> * src/conf/nwfilter_params.c (virNWFilterVarValueCopy)
> (virNWFilterVarValueGetSimple)
> (virNWFilterVarValueGetCardinality, virNWFilterVarValueEqual)
> (virNWFilterVarCombIterAddVariable)
> (virNWFilterVarCombIterGetVarValue, virNWFilterVarValueCompare)
> (virNWFilterFormatParamAttributes, virNWFilterVarAccessEqual)
> (virNWFilterVarAccessGetVarName, virNWFilterVarAccessGetType)
> (virNWFilterVarAccessGetIterId, virNWFilterVarAccessGetIndex)
> (virNWFilterVarAccessGetIntIterId)
> (virNWFilterVarAccessIsAvailable)
> (virNWFilterVarValueGetNthValue): Likewise.
> * src/nwfilter/nwfilter_ebiptables_driver.c (ebtablesApplyBasicRules)
> (ebtablesApplyDHCPOnlyRules, ebiptablesRuleOrderSort)
> (ebiptablesRuleOrderSortPtr): Likewise.
> * src/conf/nwfilter_conf.c (virNWFilterDefEqual)
> (virNWFilterDefFormat): Likewise.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  src/conf/nwfilter_conf.c                  |  6 ++---
>  src/conf/nwfilter_conf.h                  |  8 +++---
>  src/conf/nwfilter_params.c                | 44 +++++++++++++++----------------
>  src/conf/nwfilter_params.h                | 32 +++++++++++-----------
>  src/nwfilter/nwfilter_dhcpsnoop.c         | 12 ++++-----
>  src/nwfilter/nwfilter_dhcpsnoop.h         |  3 ++-
>  src/nwfilter/nwfilter_ebiptables_driver.c | 12 ++++-----
>  src/nwfilter/nwfilter_gentech_driver.c    | 23 ++++++++--------
>  src/nwfilter/nwfilter_gentech_driver.h    | 11 ++++----
>  src/nwfilter/nwfilter_learnipaddr.c       |  9 ++++---
>  src/nwfilter/nwfilter_learnipaddr.h       |  4 +--
>  11 files changed, 83 insertions(+), 81 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]