Remove the rather bulky function in favor of an XPath query. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/conf/domain_conf.c | 27 ++------------------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f5bc6148a2..c8d756c45d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8540,30 +8540,6 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, } -static int -virDomainDiskSourceEncryptionParse(xmlNodePtr node, - virStorageEncryptionPtr *encryptionsrc, - xmlXPathContextPtr ctxt) -{ - xmlNodePtr child; - virStorageEncryptionPtr encryption = NULL; - - for (child = node->children; child; child = child->next) { - if (child->type == XML_ELEMENT_NODE && - virXMLNodeNameEqual(child, "encryption")) { - - if (!(encryption = virStorageEncryptionParseNode(child, ctxt))) - return -1; - - *encryptionsrc = encryption; - return 0; - } - } - - return 0; -} - - static int virDomainDiskSourcePrivateDataParse(xmlXPathContextPtr ctxt, virStorageSourcePtr src, @@ -8638,7 +8614,8 @@ virDomainDiskSourceParse(xmlNodePtr node, !(src->auth = virStorageAuthDefParse(tmp, ctxt))) goto cleanup; - if (virDomainDiskSourceEncryptionParse(node, &src->encryption, ctxt) < 0) + if ((tmp = virXPathNode("./encryption", ctxt)) && + !(src->encryption = virStorageEncryptionParseNode(tmp, ctxt))) goto cleanup; if (virDomainDiskSourcePrivateDataParse(ctxt, src, flags, xmlopt) < 0) -- 2.16.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list