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

Re: [libvirt] [PATCH 02/15] conf: Refactor virCPUDefParseXML



On Mon, Jun 05, 2017 at 11:26:50AM +0200, Jiri Denemark wrote:
> Signed-off-by: Jiri Denemark <jdenemar redhat com>
> ---
>  src/conf/cpu_conf.c    | 105 +++++++++++++++++++++++++++----------------------
>  src/conf/cpu_conf.h    |   9 +++--
>  src/conf/domain_conf.c |  12 +-----
>  src/cpu/cpu.c          |   5 +--
>  tests/cputest.c        |   5 +--
>  5 files changed, 68 insertions(+), 68 deletions(-)
> 
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index 79ed5e646..f7f726761 100644
> --- a/src/conf/cpu_conf.c
> +++ b/src/conf/cpu_conf.c
> @@ -245,12 +245,21 @@ virCPUDefCopy(const virCPUDef *cpu)
>  }
>  
>  
> -virCPUDefPtr
> -virCPUDefParseXML(xmlNodePtr node,
> -                  xmlXPathContextPtr ctxt,
> -                  virCPUType type)
> +/*
> + * Parses CPU definition XML from a node pointed to by @xpath. If @xpath is
> + * NULL, the current node of @ctxt is used (i.e., it is a shortcut to ".").
> + *
> + * Returns  0 on success,
> + *          1 when @xpath element cannot be found in @ctxt,
> + *         -1 on error.
> + */

All the paths in the whole series checks only for return value < 0 so
there is no reason to return 1.  Another thing is that if the return
value is 1 the @cpu would be NULL and that isn't documented.  So we can
return only 0|-1 and document that the @cpu can be NULL if @xpath was
provided but not found in ctxt.

Pavel

Attachment: signature.asc
Description: Digital signature


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