[libvirt] [PATCHv2 3/3] conf: Refactor virDomainDiskSourceDefParse

Peter Krempa pkrempa at redhat.com
Thu Nov 7 14:11:50 UTC 2013


On 11/07/13 11:16, Peter Krempa wrote:
> Now that the function is separate clean out a few ugly places and fix up
> error messages.
> ---
> 
> Notes:
>     Version 2:
>     - rebased to changes in 1/3 of this series
> 
>  src/conf/domain_conf.c | 119 ++++++++++++++++++++++++-------------------------
>  1 file changed, 59 insertions(+), 60 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 4d3812a..a1c39c2 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

...

> -       when they mean to omit the source element
> -       completely (e.g. CDROM without media). This is
> -       just a little compatibility check to help
> -       those broken apps */
> +    /* People sometimes pass a bogus '' source path when they mean to omit the
> +     * source element completely (e.g. CDROM without media). This is just a
> +     * little compatibility check to help those broken apps */
>      if (*source && STREQ(*source, ""))
>          VIR_FREE(*source);
> 
> -    *ndefhosts = nhosts;
> -    *defhosts = hosts;
> -    nhosts = 0;
> -
>      ret = 0;
> 
>  error:
> -    VIR_FREE(protocol);
> -    VIR_FREE(transport);
> -    while (nhosts > 0) {
> +   while (nhosts > 0) {
>          virDomainDiskHostDefClear(&hosts[nhosts - 1]);
>          nhosts--;
>      }

Yuck; I forgot to nuke the whole error section when solving the conflict :/.

Everything between the error: label and the cleanup label is now removed
in my private branch. I can re-send this patch if required

> 
> +cleanup:
> +    virDomainDiskHostDefClear(&host);
> +    VIR_FREE(protocol);
> +    VIR_FREE(transport);
>      return ret;
>  }
> 

Sorry for the mess.

PEter

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 901 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20131107/47e7372e/attachment-0001.sig>


More information about the libvir-list mailing list