separate virDomainDefParseGraphicsInfo from virDomainDefParseXML, move virDomainDefParseGraphicsInfo into virDomainDefParseDeviceInfo --- src/conf/domain_conf.c | 51 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index eb610ed..71b5147 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20290,6 +20290,40 @@ virDomainDefParseInputInfo(virDomainParseTotalParamPtr param) static int +virDomainDefParseGraphicsInfo(virDomainParseTotalParamPtr param) +{ + virDomainDefPtr def = param->def; + xmlXPathContextPtr ctxt = param->ctxt; + unsigned int flags = param->flags; + + int ret = -1; + int n = 0; + size_t i; + xmlNodePtr *nodes = NULL; + + /* analysis of the graphics devices */ + if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0) + goto cleanup; + if (n && VIR_ALLOC_N(def->graphics, n) < 0) + goto cleanup; + for (i = 0; i < n; i++) { + virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(nodes[i], + ctxt, + flags); + if (!graphics) + goto cleanup; + + def->graphics[def->ngraphics++] = graphics; + } + ret = 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + +static int virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) { typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param); @@ -20308,6 +20342,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) virDomainDefParseConsoleInfo, virDomainDefParseChannelInfo, virDomainDefParseInputInfo, + virDomainDefParseGraphicsInfo, NULL }; @@ -20411,22 +20446,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* analysis of the graphics devices */ - if ((n = virXPathNodeSet("./devices/graphics", ctxt, &nodes)) < 0) - goto error; - if (n && VIR_ALLOC_N(def->graphics, n) < 0) - goto error; - for (i = 0; i < n; i++) { - virDomainGraphicsDefPtr graphics = virDomainGraphicsDefParseXML(nodes[i], - ctxt, - flags); - if (!graphics) - goto error; - - def->graphics[def->ngraphics++] = graphics; - } - VIR_FREE(nodes); - /* analysis of the sound devices */ if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0) goto error; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list