summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-01-10 18:43:15 +0300
committerAndrei Karas <akaras@inbox.ru>2012-01-10 18:43:15 +0300
commitbad730dd0de24b2b17b91922c0c7f2b31b7b4d9b (patch)
tree06c1d723a051b57cc4c107df1d7bb00296dbe99b /src/utils
parent08dc59e8bff25736d15d11313e0296f60e248e0a (diff)
downloadmv-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.tar.gz
mv-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.tar.bz2
mv-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.tar.xz
mv-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.zip
Move libxml2 includes to xml.h
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/xml.cpp16
-rw-r--r--src/utils/xml.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index 87833d176..5a9558cc2 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -32,6 +32,11 @@
#include "debug.h"
+static void xmlNullLogger(void *ctx A_UNUSED, const char *msg A_UNUSED, ...)
+{
+ // Does nothing, that's the whole point of it
+}
+
namespace XML
{
Document::Document(const std::string &filename, bool useResman):
@@ -165,4 +170,15 @@ namespace XML
return nullptr;
}
+ // Initialize libxml2 and check for potential ABI mismatches between
+ // compiled version and the shared library actually used.
+ void initXML()
+ {
+ xmlInitParser();
+ LIBXML_TEST_VERSION;
+
+ // Suppress libxml2 error messages
+ xmlSetGenericErrorFunc(nullptr, xmlNullLogger);
+ }
+
} // namespace XML
diff --git a/src/utils/xml.h b/src/utils/xml.h
index e35a2a06f..2b97b45f5 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -23,6 +23,8 @@
#ifndef XML_H
#define XML_H
+#include <libxml/encoding.h>
+#include <libxml/xmlwriter.h>
#include <libxml/tree.h>
#include <string>
@@ -94,6 +96,8 @@ namespace XML
* Finds the first child node with the given name
*/
xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name);
+
+ void initXML();
}
#define for_each_xml_child_node(var, parent) \