[Libguestfs] [PATCH 1/2] libvirt: un-duplicate XPath code

Richard W.M. Jones rjones at redhat.com
Wed Dec 7 11:57:50 UTC 2016


On Wed, Nov 16, 2016 at 12:59:38PM +0100, Pino Toscano wrote:
> Move the checks for empty xmlXPathObjectPtr, and for extracting the
> result string out of it, to a new helper functions.
> 
> This is just code motion, there should be no behaviour changes.
> ---
>  src/libvirt-domain.c | 122 +++++++++++++++++++++------------------------------
>  1 file changed, 50 insertions(+), 72 deletions(-)
> 
> diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
> index 4d4142d..baab307 100644
> --- a/src/libvirt-domain.c
> +++ b/src/libvirt-domain.c
> @@ -43,6 +43,8 @@ static xmlDocPtr get_domain_xml (guestfs_h *g, virDomainPtr dom);
>  static ssize_t for_each_disk (guestfs_h *g, virConnectPtr conn, xmlDocPtr doc, int (*f) (guestfs_h *g, const char *filename, const char *format, int readonly, const char *protocol, char *const *server, const char *username, void *data), void *data);
>  static int libvirt_selinux_label (guestfs_h *g, xmlDocPtr doc, char **label_rtn, char **imagelabel_rtn);
>  static char *filename_from_pool (guestfs_h *g, virConnectPtr conn, const char *pool_nane, const char *volume_name);
> +static bool xPathObjectIsEmpty (xmlXPathObjectPtr obj);
> +static char *xPathObjectGetString (xmlDocPtr doc, xmlXPathObjectPtr obj);

To be consistent with the rest of the code, xpath_object_is_empty etc.

ACK with that changed.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.
http://libguestfs.org/virt-v2v




More information about the Libguestfs mailing list