[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [libvirt-glib 2/7] Make root_node optional in gvir_config_xml_parse



It's only used to make some sanity checks on what was just parsed,
so allowing NULL root_node is fine.
---
 libvirt-gconfig/libvirt-gconfig-helpers.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libvirt-gconfig/libvirt-gconfig-helpers.c b/libvirt-gconfig/libvirt-gconfig-helpers.c
index fecf3eb..a9aaa0b 100644
--- a/libvirt-gconfig/libvirt-gconfig-helpers.c
+++ b/libvirt-gconfig/libvirt-gconfig-helpers.c
@@ -148,7 +148,8 @@ gvir_config_xml_parse(const char *xml, const char *root_node, GError **err)
                                       "Unable to parse configuration");
         return NULL;
     }
-    if ((!doc->children) || (strcmp((char *)doc->children->name, root_node) != 0)) {
+    if ((!doc->children) ||
+         ((root_node != NULL) && g_strcmp0((char *)doc->children->name, root_node) != 0)) {
         g_set_error(err,
                     GVIR_CONFIG_OBJECT_ERROR,
                     0,
-- 
1.7.7.6


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]