[libvirt] [PATCH 09/10] conf: use virXMLNodeContentString for boot options parsing

Pavel Hrdina posted 10 patches 8 years, 4 months ago
[libvirt] [PATCH 09/10] conf: use virXMLNodeContentString for boot options parsing
Posted by Pavel Hrdina 8 years, 4 months ago
Using XPath here doesn't add any benefit.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 src/conf/domain_conf.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index ea293b9f02..db042e5dc1 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -17062,7 +17062,6 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
                              virHashTablePtr *bootHash)
 {
     xmlNodePtr *nodes = NULL;
-    xmlNodePtr oldnode;
     char *tmp = NULL;
     char *name = NULL;
     int ret = -1;
@@ -17169,8 +17168,6 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
         }
 
         if (n == 1) {
-            oldnode = ctxt->node;
-            ctxt->node = nodes[0];
             tmp = virXMLPropString(nodes[0], "type");
 
             if (!tmp) {
@@ -17181,7 +17178,7 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
 
             if (STREQ_NULLABLE(tmp, "slic")) {
                 VIR_FREE(tmp);
-                tmp = virXPathString("string(.)", ctxt);
+                tmp = virXMLNodeContentString(nodes[0]);
                 def->os.slic_table = virFileSanitizePath(tmp);
                 VIR_FREE(tmp);
             } else {
@@ -17190,7 +17187,6 @@ virDomainDefParseBootOptions(virDomainDefPtr def,
                                tmp);
                 goto error;
             }
-            ctxt->node = oldnode;
         }
 
         if (virDomainDefParseBootXML(ctxt, def) < 0)
-- 
2.13.5

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH 09/10] conf: use virXMLNodeContentString for boot options parsing
Posted by Ján Tomko 8 years, 4 months ago
On Wed, Aug 16, 2017 at 02:40:46PM +0200, Pavel Hrdina wrote:
>Using XPath here doesn't add any benefit.
>
>Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
>---
> src/conf/domain_conf.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>

ACK,

thank you for cleaning this up after me.

Jan
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list