[libvirt PATCH] conf: virDomainDefParseMemory: remove pointless assignment

Ján Tomko posted 1 patch 1 year, 10 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/26261fe48af3ceb12667191d3a0a934494308e30.1655898382.git.jtomko@redhat.com
src/conf/domain_conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[libvirt PATCH] conf: virDomainDefParseMemory: remove pointless assignment
Posted by Ján Tomko 1 year, 10 months ago
Evaluate the XPath as a boolean, instead of trying to get a node
out of it.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
---
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 9fe930a5d8..709ca53790 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19184,7 +19184,7 @@ virDomainDefParseMemory(virDomainDef *def,
         }
     }
 
-    if ((node = virXPathNode("./memoryBacking/nosharepages", ctxt)))
+    if (virXPathBoolean("boolean(./memoryBacking/nosharepages)", ctxt))
         def->mem.nosharepages = true;
 
     if (virXPathBoolean("boolean(./memoryBacking/locked)", ctxt))
-- 
2.34.1

Re: [libvirt PATCH] conf: virDomainDefParseMemory: remove pointless assignment
Posted by Michal Prívozník 1 year, 10 months ago
On 6/22/22 13:46, Ján Tomko wrote:
> Evaluate the XPath as a boolean, instead of trying to get a node
> out of it.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> ---
>  src/conf/domain_conf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>

Michal