diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-01-10 18:43:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-01-10 18:43:15 +0300 |
commit | bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b (patch) | |
tree | 06c1d723a051b57cc4c107df1d7bb00296dbe99b | |
parent | 08dc59e8bff25736d15d11313e0296f60e248e0a (diff) | |
download | manaverse-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.tar.gz manaverse-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.tar.bz2 manaverse-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.tar.xz manaverse-bad730dd0de24b2b17b91922c0c7f2b31b7b4d9b.zip |
Move libxml2 includes to xml.h
-rw-r--r-- | src/animationparticle.h | 2 | ||||
-rw-r--r-- | src/configuration.cpp | 3 | ||||
-rw-r--r-- | src/configuration.h | 3 | ||||
-rw-r--r-- | src/main.cpp | 22 | ||||
-rw-r--r-- | src/resources/action.h | 2 | ||||
-rw-r--r-- | src/resources/animation.h | 2 | ||||
-rw-r--r-- | src/resources/chardb.cpp | 4 | ||||
-rw-r--r-- | src/resources/chardb.h | 2 | ||||
-rw-r--r-- | src/resources/colordb.cpp | 2 | ||||
-rw-r--r-- | src/resources/itemdb.cpp | 4 | ||||
-rw-r--r-- | src/resources/mapdb.cpp | 2 | ||||
-rw-r--r-- | src/resources/mapreader.cpp | 1 | ||||
-rw-r--r-- | src/resources/mapreader.h | 2 | ||||
-rw-r--r-- | src/resources/spritedef.cpp | 2 | ||||
-rw-r--r-- | src/resources/spritedef.h | 2 | ||||
-rw-r--r-- | src/rotationalparticle.h | 2 | ||||
-rw-r--r-- | src/utils/xml.cpp | 16 | ||||
-rw-r--r-- | src/utils/xml.h | 4 |
18 files changed, 32 insertions, 45 deletions
diff --git a/src/animationparticle.h b/src/animationparticle.h index 45110501a..27e7d0b22 100644 --- a/src/animationparticle.h +++ b/src/animationparticle.h @@ -25,7 +25,7 @@ #include "imageparticle.h" -#include <libxml/tree.h> +#include "utils/xml.h" class Animation; class Map; diff --git a/src/configuration.cpp b/src/configuration.cpp index bed7c0878..40c3ab8c3 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -27,9 +27,6 @@ #include "utils/paths.h" #include "utils/stringutils.h" -#include "utils/xml.h" - -#include <libxml/encoding.h> #include <stdlib.h> diff --git a/src/configuration.h b/src/configuration.h index ae8908bfd..7e4c65a40 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -24,9 +24,10 @@ #define CONFIGURATION_H #include "utils/stringutils.h" +#include "utils/xml.h" + #include "defaults.h" -#include <libxml/xmlwriter.h> #include <cassert> #include <list> diff --git a/src/main.cpp b/src/main.cpp index 71794487c..9bffcfa2a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -27,13 +27,12 @@ #include "client.h" #include "logger.h" -#include <libxml/parser.h> - #include <getopt.h> #include <iostream> #include <physfs.h> #include "utils/stringutils.h" +#include "utils/xml.h" #ifdef __MINGW32__ #include <windows.h> @@ -210,23 +209,6 @@ static void parseOptions(int argc, char *argv[], Client::Options &options) extern "C" char const *_nl_locale_name_default(void); #endif -static void xmlNullLogger(void *ctx A_UNUSED, const char *msg A_UNUSED, ...) -{ - // Does nothing, that's the whole point of it -} - -// Initialize libxml2 and check for potential ABI mismatches between -// compiled version and the shared library actually used. -static void initXML() -{ - xmlInitParser(); - LIBXML_TEST_VERSION; - - // Suppress libxml2 error messages - xmlSetGenericErrorFunc(nullptr, xmlNullLogger); -} - - int main(int argc, char *argv[]) { #if defined(__MINGW32__) @@ -262,7 +244,7 @@ int main(int argc, char *argv[]) atexit((void(*)()) PHYSFS_deinit); - initXML(); + XML::initXML(); #ifdef WIN32 SetCurrentDirectory(PHYSFS_getBaseDir()); diff --git a/src/resources/action.h b/src/resources/action.h index 603135875..1e3965363 100644 --- a/src/resources/action.h +++ b/src/resources/action.h @@ -23,7 +23,7 @@ #ifndef ACTION_H #define ACTION_H -#include <libxml/tree.h> +#include "utils/xml.h" #include <map> diff --git a/src/resources/animation.h b/src/resources/animation.h index f52234abb..33bfd76e9 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.h @@ -23,7 +23,7 @@ #ifndef ANIMATION_H #define ANIMATION_H -#include <libxml/tree.h> +#include "utils/xml.h" #include <vector> #include <string> diff --git a/src/resources/chardb.cpp b/src/resources/chardb.cpp index c6de2e189..30408c239 100644 --- a/src/resources/chardb.cpp +++ b/src/resources/chardb.cpp @@ -24,10 +24,6 @@ #include "client.h" #include "logger.h" -#include "utils/xml.h" - -#include <libxml/tree.h> - #include "debug.h" namespace diff --git a/src/resources/chardb.h b/src/resources/chardb.h index 8be2c34c4..c668c1a73 100644 --- a/src/resources/chardb.h +++ b/src/resources/chardb.h @@ -25,7 +25,7 @@ #include <map> #include <string> -#include <libxml/tree.h> +#include "utils/xml.h" /** * Char information database. diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp index 41393541f..2a79f0554 100644 --- a/src/resources/colordb.cpp +++ b/src/resources/colordb.cpp @@ -26,8 +26,6 @@ #include "utils/xml.h" -#include <libxml/tree.h> - #include "debug.h" namespace diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index e7cc0f931..2c381286a 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -23,6 +23,7 @@ #include "resources/itemdb.h" #include "client.h" +#include "configuration.h" #include "logger.h" #include "resources/iteminfo.h" @@ -32,9 +33,6 @@ #include "utils/gettext.h" #include "utils/stringutils.h" #include "utils/xml.h" -#include "configuration.h" - -#include <libxml/tree.h> #include "debug.h" diff --git a/src/resources/mapdb.cpp b/src/resources/mapdb.cpp index e61ee45b0..1da3dd908 100644 --- a/src/resources/mapdb.cpp +++ b/src/resources/mapdb.cpp @@ -27,8 +27,6 @@ #include "utils/xml.h" -#include <libxml/tree.h> - #include "debug.h" namespace diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 5ebfe5fe3..8c8bf2f9d 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -35,7 +35,6 @@ #include "utils/base64.h" #include "utils/gettext.h" #include "utils/stringutils.h" -#include "utils/xml.h" #include <iostream> #include <zlib.h> diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 301b7d7ce..8fc11e70f 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.h @@ -23,7 +23,7 @@ #ifndef MAPREADER_H #define MAPREADER_H -#include <libxml/tree.h> +#include "utils/xml.h" #include <string> diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index 1122cb2e9..40bdb64c8 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -33,8 +33,6 @@ #include "configuration.h" -#include "utils/xml.h" - #include "debug.h" SpriteReference *SpriteReference::Empty = nullptr; diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 9e756bdf7..3f656be0d 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -25,7 +25,7 @@ #include "resources/resource.h" -#include <libxml/tree.h> +#include "utils/xml.h" #include <list> #include <map> diff --git a/src/rotationalparticle.h b/src/rotationalparticle.h index 19e71e62c..96b7a29ff 100644 --- a/src/rotationalparticle.h +++ b/src/rotationalparticle.h @@ -25,7 +25,7 @@ #include "imageparticle.h" -#include <libxml/tree.h> +#include "utils/xml.h" class Animation; class Map; 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) \ |