diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-11-04 22:26:12 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2006-11-04 22:26:12 +0000 |
commit | e4d5ea07c80df5e7423feed24ac21f8bc683acb6 (patch) | |
tree | 284e180331a358c1975be7263532f98c12b895aa /src/main.cpp | |
parent | 46308b7e9d65dd734664f903a09c3210f1684a6c (diff) | |
download | mana-e4d5ea07c80df5e7423feed24ac21f8bc683acb6.tar.gz mana-e4d5ea07c80df5e7423feed24ac21f8bc683acb6.tar.bz2 mana-e4d5ea07c80df5e7423feed24ac21f8bc683acb6.tar.xz mana-e4d5ea07c80df5e7423feed24ac21f8bc683acb6.zip |
Add a libxml2 init wrapper.
Use a null-logger function instead of /dev/null to quieten libxml2.
Actually initialize libxml2 before using it to load the configuration.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/main.cpp b/src/main.cpp index ea2b7829..5711600a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -188,7 +188,6 @@ void initConfiguration(const Options &options) config.setValue("fpslimit", 0); config.setValue("updatehost", "http://themanaworld.org/files"); config.setValue("customcursor", 1); - config.setValue("homeDir", homeDir); // Checking if the configuration file exists... otherwise create it with // default options. @@ -485,6 +484,23 @@ void accountRegister(LoginData *loginData) loginData->username, loginData->password, loginData->email); } +void xmlNullLogger(void *ctx, const char *msg, ...) +{ + // 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. +void initXML() +{ + logger->log("Initializing libxml2..."); + xmlInitParser(); + LIBXML_TEST_VERSION; + + // Suppress libxml2 error messages + xmlSetGenericErrorFunc(NULL, xmlNullLogger); +} + /** Main */ int main(int argc, char *argv[]) { @@ -504,6 +520,7 @@ int main(int argc, char *argv[]) // Initialize PhysicsFS PHYSFS_init(argv[0]); + initXML(); initHomeDir(); initConfiguration(options); @@ -517,20 +534,8 @@ int main(int argc, char *argv[]) logger->log("The Mana World v%s", PACKAGE_VERSION); #endif - // Initialize libxml2 and check for potential ABI mismatches between - // compiled version and the shared library actually used. - logger->log("Initializing libxml2..."); - xmlInitParser(); - LIBXML_TEST_VERSION; - - // Redirect libxml errors to /dev/null - FILE *nullFile = fopen("/dev/null", "w"); - xmlSetGenericErrorFunc(nullFile, NULL); - init_engine(); - unsigned int oldstate = !state; // We start with a status change. - Window *currentDialog = NULL; Image *login_wallpaper = NULL; Game *game = NULL; @@ -569,8 +574,9 @@ int main(int argc, char *argv[]) gameServerConnection = Net::getConnection(); chatServerConnection = Net::getConnection(); - SDL_Event event; + unsigned int oldstate = !state; // We start with a status change. + SDL_Event event; while (state != STATE_EXIT) { // Handle SDL events @@ -775,10 +781,6 @@ int main(int argc, char *argv[]) delete chatServerConnection; Net::finalize(); - if (nullFile) - { - fclose(nullFile); - } logger->log("State: EXIT"); exit_engine(); PHYSFS_deinit(); |