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

[libvirt] [PATCH 1/8] util: introduce virXMLNodeNameEqual



Signed-off-by: Pavel Hrdina <phrdina redhat com>
---
 src/libvirt_private.syms |  1 +
 src/util/virxml.c        | 16 ++++++++++++++++
 src/util/virxml.h        |  3 +++
 3 files changed, 20 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 447dd938d0..4f1ad2a0cc 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2931,6 +2931,7 @@ virVHBAPathExists;
 virXMLCheckIllegalChars;
 virXMLChildElementCount;
 virXMLExtractNamespaceXML;
+virXMLNodeNameEqual;
 virXMLNodeSanitizeNamespaces;
 virXMLNodeToString;
 virXMLParseHelper;
diff --git a/src/util/virxml.c b/src/util/virxml.c
index 39049d869b..b42358a08c 100644
--- a/src/util/virxml.c
+++ b/src/util/virxml.c
@@ -950,6 +950,22 @@ virXMLNodeToString(xmlDocPtr doc,
     return ret;
 }
 
+
+/**
+ * virXMLNodeNameEqual:
+ * @node: xml Node pointer to check
+ * @name: name of the @node
+ *
+ * Compares the @node name with @name.
+ */
+bool
+virXMLNodeNameEqual(xmlNodePtr node,
+                    const char *name)
+{
+    return xmlStrEqual(node->name, BAD_CAST name);
+}
+
+
 typedef int (*virXMLForeachCallback)(xmlNodePtr node,
                                      void *opaque);
 
diff --git a/src/util/virxml.h b/src/util/virxml.h
index 17fccd81f4..2f953a6d44 100644
--- a/src/util/virxml.h
+++ b/src/util/virxml.h
@@ -168,6 +168,9 @@ int virXMLSaveFile(const char *path,
 
 char *virXMLNodeToString(xmlDocPtr doc, xmlNodePtr node);
 
+bool virXMLNodeNameEqual(xmlNodePtr node,
+                         const char *name);
+
 xmlNodePtr virXMLFindChildNodeByNs(xmlNodePtr root,
                                    const char *uri);
 
-- 
2.13.5


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