separate virDomainDefParseMetadataInfo from virDomainDefParseXML --- src/conf/domain_conf.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 03bf5ad..7006e7f 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -21034,6 +21034,17 @@ virDomainDefParseKeyWrapInfo(virDomainParseTotalParamPtr param) } +static int +virDomainDefParseMetadataInfo(virDomainParseTotalParamPtr param) +{ + xmlNodePtr node = NULL; + /* Extract custom metadata */ + if ((node = virXPathNode("./metadata[1]", param->ctxt)) != NULL) + param->def->metadata = xmlCopyNode(node, 1); + + return 0; +} + static virDomainDefPtr virDomainDefParseXML(xmlDocPtr xml, xmlNodePtr root, @@ -21045,8 +21056,6 @@ virDomainDefParseXML(xmlDocPtr xml, { typedef int (*virDomainPreaseInfoFunc)(virDomainParseTotalParamPtr params); - xmlNodePtr *nodes = NULL, node = NULL; - char *tmp = NULL; size_t fun_index = 0; virDomainDefPtr def; virHashTablePtr bootHash = NULL; @@ -21090,6 +21099,7 @@ virDomainDefParseXML(xmlDocPtr xml, virDomainDefParseIdmapInfo, virDomainDefParseSysinfoInfo, virDomainDefParseKeyWrapInfo, + virDomainDefParseMetadataInfo, NULL }; @@ -21121,10 +21131,6 @@ virDomainDefParseXML(xmlDocPtr xml, fun_index++; } - /* Extract custom metadata */ - if ((node = virXPathNode("./metadata[1]", ctxt)) != NULL) - def->metadata = xmlCopyNode(node, 1); - /* we have to make a copy of all of the callback pointers here since * we won't have the virCaps structure available during free */ @@ -21148,8 +21154,6 @@ virDomainDefParseXML(xmlDocPtr xml, return def; error: - VIR_FREE(tmp); - VIR_FREE(nodes); virHashFree(bootHash); virDomainDefFree(def); return NULL; -- 2.8.3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list