Re: [PATCH 05/15] maint: avoid 'const fooPtr' in cpu files

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

 



On Tue, Oct 08, 2013 at 11:25: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 offenders in src/cpu.
> 
> * src/cpu/cpu.h (cpuArchDecode, cpuArchEncode, cpuArchUpdate)
> (cpuArchHasFeature, cpuDecode, cpuEncode, cpuUpdate)
> (cpuHasFeature): Use intended type.
> * src/conf/cpu_conf.h (virCPUDefCopyModel, virCPUDefCopy):
> Likewise.
> (virCPUDefParseXML): Drop const.
> * src/cpu/cpu.c (cpuDecode, cpuEncode, cpuUpdate, cpuHasFeature):
> Fix fallout.
> * src/cpu/cpu_x86.c (x86ModelFromCPU, x86ModelSubtractCPU)
> (x86DecodeCPUData, x86EncodePolicy, x86Encode, x86UpdateCustom)
> (x86UpdateHostModel, x86Update, x86HasFeature): Likewise.
> * src/cpu/cpu_s390.c (s390Decode): Likewise.
> * src/cpu/cpu_arm.c (ArmDecode): Likewise.
> * src/cpu/cpu_powerpc.c (ppcModelFromCPU, ppcCompute, ppcDecode)
> (ppcUpdate): Likewise.
> * src/conf/cpu_conf.c (virCPUDefCopyModel, virCPUDefCopy)
> (virCPUDefParseXML): Likewise.
> 
> Signed-off-by: Eric Blake <eblake@xxxxxxxxxx>
> ---
>  src/conf/cpu_conf.c   |  6 +++---
>  src/conf/cpu_conf.h   |  8 ++++----
>  src/cpu/cpu.c         |  8 ++++----
>  src/cpu/cpu.h         | 16 ++++++++--------
>  src/cpu/cpu_arm.c     |  3 ++-
>  src/cpu/cpu_powerpc.c |  9 +++++----
>  src/cpu/cpu_s390.c    |  3 ++-
>  src/cpu/cpu_x86.c     | 18 +++++++++---------
>  8 files changed, 37 insertions(+), 34 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]