]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
conf: use virXMLPropStringLimit where it makes sense
authorPavel Hrdina <phrdina@redhat.com>
Tue, 15 Aug 2017 13:31:06 +0000 (15:31 +0200)
committerPavel Hrdina <phrdina@redhat.com>
Thu, 17 Aug 2017 13:42:47 +0000 (15:42 +0200)
The XPath call for these cases is more expensive than accessing the
XML dom node directly.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
src/conf/domain_conf.c

index 83432fa5b089edce4c2d8018fec6b2ba5e36edb4..ea293b9f02c7e5493acedef2eec194457255797f 100644 (file)
@@ -7227,8 +7227,8 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
     char *p;
     virSecurityLabelDefPtr seclabel = NULL;
 
-    p = virXPathStringLimit("string(./@model)",
-                            VIR_SECURITY_MODEL_BUFLEN - 1, ctxt);
+    p = virXMLPropStringLimit(ctxt->node, "model",
+                              VIR_SECURITY_MODEL_BUFLEN - 1);
 
     if (!(seclabel = virSecurityLabelDefNew(p)))
         goto error;
@@ -7237,8 +7237,8 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
     /* set default value */
     seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
 
-    p = virXPathStringLimit("string(./@type)",
-                            VIR_SECURITY_LABEL_BUFLEN - 1, ctxt);
+    p = virXMLPropStringLimit(ctxt->node, "type",
+                              VIR_SECURITY_LABEL_BUFLEN - 1);
     if (p) {
         seclabel->type = virDomainSeclabelTypeFromString(p);
         if (seclabel->type <= 0) {
@@ -7253,8 +7253,8 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
         seclabel->relabel = false;
 
     VIR_FREE(p);
-    p = virXPathStringLimit("string(./@relabel)",
-                            VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
+    p = virXMLPropStringLimit(ctxt->node, "relabel",
+                              VIR_SECURITY_LABEL_BUFLEN-1);
     if (p) {
         if (STREQ(p, "yes")) {
             seclabel->relabel = true;