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

Daniel P. Berrange berrange at redhat.com
Mon Oct 14 15:20:41 UTC 2013


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 at redhat.com>
> ---
>  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 :|




More information about the libvir-list mailing list