Re: [PATCH 05/18] domain_conf: split graphics xml parser into multiple functions

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

 



On Mon, Apr 04, 2016 at 03:20:22PM +0200, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/conf/domain_conf.c | 835 +++++++++++++++++++++++++++----------------------
>  1 file changed, 453 insertions(+), 382 deletions(-)
> 

s/ParseXMLVnc/ParseXMLVNC/g
s/ParseXMLSdl/ParseXMLSDL/g
s/ParseXMLRdp/ParseXMLRDP/g

would IMO look nicer.

> +
> +    if ((def->type = virDomainGraphicsTypeFromString(type)) < 0) {
> +        virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
> +                       _("unknown graphics device type '%s'"), type);
> +        goto error;
> +    }
> +
> +    if (virDomainGraphicsListensParseXML(def, node, ctxt, flags) < 0)
> +        goto error;
> +
> +    switch (def->type) {

You could also cast the type to the enum, to annoy anyone adding a new
graphics type to add it to this switch too.

ACK

Jan

> +    case VIR_DOMAIN_GRAPHICS_TYPE_VNC:
> +        if (virDomainGraphicsDefParseXMLVnc(def, node, flags) < 0)
> +            goto error;
> +        break;
> +    case VIR_DOMAIN_GRAPHICS_TYPE_SDL:
> +        if (virDomainGraphicsDefParseXMLSdl(def, node) < 0)
> +            goto error;
> +        break;
> +    case VIR_DOMAIN_GRAPHICS_TYPE_RDP:
> +        if (virDomainGraphicsDefParseXMLRdp(def, node, flags) < 0)
> +            goto error;
> +        break;
> +    case VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP:
> +        if (virDomainGraphicsDefParseXMLDesktop(def, node) < 0)
> +            goto error;
> +        break;
> +    case VIR_DOMAIN_GRAPHICS_TYPE_SPICE:
> +        if (virDomainGraphicsDefParseXMLSpice(def, node, flags) < 0)
> +            goto error;
> +        break;
>      }
>  

--
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]