separate virDomainDefParseSoundInfo from virDomainDefParseXML, move virDomainDefParseSoundInfo into virDomainDefParseDeviceInfo --- src/conf/domain_conf.c | 54 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 71b5147..6ffde63 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20324,6 +20324,42 @@ virDomainDefParseGraphicsInfo(virDomainParseTotalParamPtr param) static int +virDomainDefParseSoundInfo(virDomainParseTotalParamPtr param) +{ + virDomainDefPtr def = param->def; + xmlXPathContextPtr ctxt = param->ctxt; + virDomainXMLOptionPtr xmlopt = param->xmlopt; + unsigned int flags = param->flags; + + int ret = -1; + int n = 0; + size_t i; + xmlNodePtr *nodes = NULL; + + /* analysis of the sound devices */ + if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0) + goto cleanup; + if (n && VIR_ALLOC_N(def->sounds, n) < 0) + goto cleanup; + for (i = 0; i < n; i++) { + virDomainSoundDefPtr sound = virDomainSoundDefParseXML(xmlopt, + nodes[i], + ctxt, + flags); + if (!sound) + goto cleanup; + + def->sounds[def->nsounds++] = sound; + } + ret = 0; + + cleanup: + VIR_FREE(nodes); + return ret; +} + + +static int virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) { typedef int (*virDomainPreaseDeviceFuc)(virDomainParseTotalParamPtr param); @@ -20343,6 +20379,7 @@ virDomainDefParseDeviceInfo(virDomainParseTotalParamPtr param) virDomainDefParseChannelInfo, virDomainDefParseInputInfo, virDomainDefParseGraphicsInfo, + virDomainDefParseSoundInfo, NULL }; @@ -20446,23 +20483,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* analysis of the sound devices */ - if ((n = virXPathNodeSet("./devices/sound", ctxt, &nodes)) < 0) - goto error; - if (n && VIR_ALLOC_N(def->sounds, n) < 0) - goto error; - for (i = 0; i < n; i++) { - virDomainSoundDefPtr sound = virDomainSoundDefParseXML(xmlopt, - nodes[i], - ctxt, - flags); - if (!sound) - goto error; - - def->sounds[def->nsounds++] = sound; - } - VIR_FREE(nodes); - /* analysis of the video devices */ if ((n = virXPathNodeSet("./devices/video", ctxt, &nodes)) < 0) goto error; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list