[libvirt] [PATCH 09/15] maint: fix awkward typing of virDomainChrGetDomainPtrs

Daniel P. Berrange berrange at redhat.com
Mon Oct 14 15:32:05 UTC 2013


On Tue, Oct 08, 2013 at 11:25:06AM -0600, Eric Blake wrote:
> virDomainChrGetDomainPtrs() required 4 levels of pointers (taking
> a parameter that will be used as an output variable to return the
> address of another variable that contains an array of pointers).
> This is rather complex to reason about, especially when outside
> of the domain_conf file, no other caller should be modifying
> the resulting array of pointers directly.  Changing the public
> signature gives something is easier to reason with, and actually
> make const-correct; which is important as it was the only function
> that was blocking virDomainDeviceDefCopy from treating its source
> as const.
> 
> * src/conf/domain_conf.h (virDomainChrGetDomainPtrs): Use simpler
> types, and make const-correct for external users.
> * src/conf/domain_conf.c (virDomainChrGetDomainPtrs): Split...
> (virDomainChrGetDomainPtrsInternal): ...into an internal version
> that lets us modify terms, vs. external form that is read-only.
> (virDomainDeviceDefPostParseInternal, virDomainChrFind)
> (virDomainChrInsert): Adjust callers.
> * src/qemu/qemu_command.c (qemuGetNextChrDevIndex): Adjust caller.
> (qemuDomainDeviceAliasIndex): Make const-correct.
> 
> Signed-off-by: Eric Blake <eblake at redhat.com>
> ---
>  src/conf/domain_conf.c  | 70 ++++++++++++++++++++++++++++++++++---------------
>  src/conf/domain_conf.h  |  9 ++++---
>  src/qemu/qemu_command.c | 14 +++++-----
>  3 files changed, 61 insertions(+), 32 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