Re: [PATCH 04/18] domain_conf: cleanup virDomainGraphicsListensParseXML

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

 



On Mon, Apr 04, 2016 at 03:20:21PM +0200, Pavel Hrdina wrote:
> Refactor the listen parser to use only one loop.
> 
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 117 +++++++++++++++++++++----------------------------
>  1 file changed, 50 insertions(+), 67 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index a0ef3d9..9d48d07 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c

>  
> +    /* listen attribute of <graphics> is also supported by these,
> +     * but must match the 'address' attribute of the first listen
> +     * that is type='address' (if present) */
> +    listenAddr = virXMLPropString(node, "listen");
> +    if (listenAddr && !listenAddr[0])
> +        VIR_FREE(listenAddr);
> +
> +    if (STREQ_NULLABLE(address->address, listenAddr) < 0) {

This is dead code, since it expands to strcmp(a,b) == 0.

Drop the comparison against zero and use STRNEQ_NULLABLE instead.

Also, the check should only be done if address is non-NULL, for XMLs
with no <listen> elements.

ACK with that fixed.

Jan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]