diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2007-04-22 13:39:22 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2007-04-22 13:39:22 +0000 |
commit | 9398626764574fa536dca3806490f88970d2f056 (patch) | |
tree | b8a5f938d6d6447846773a6270802c3595077222 /src/configuration.cpp | |
parent | ccf4dd308bcb8a592ece2d86102bbaa7080f0f7e (diff) | |
download | mana-9398626764574fa536dca3806490f88970d2f056.tar.gz mana-9398626764574fa536dca3806490f88970d2f056.tar.bz2 mana-9398626764574fa536dca3806490f88970d2f056.tar.xz mana-9398626764574fa536dca3806490f88970d2f056.zip |
Added a macro for XML child node iterations to make the code more terse and easier to read.
Diffstat (limited to 'src/configuration.cpp')
-rw-r--r-- | src/configuration.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/configuration.cpp b/src/configuration.cpp index 8bb0b8ca..d33df386 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -30,6 +30,7 @@ #include "log.h" #include "utils/tostring.h" +#include "utils/xml.h" void Configuration::init(const std::string &filename) { @@ -48,14 +49,14 @@ void Configuration::init(const std::string &filename) if (!doc) return; - xmlNodePtr node = xmlDocGetRootElement(doc); + xmlNodePtr rootNode = xmlDocGetRootElement(doc); - if (!node || !xmlStrEqual(node->name, BAD_CAST "configuration")) { + if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "configuration")) { logger->log("Warning: No configuration file (%s)", filename.c_str()); return; } - for (node = node->xmlChildrenNode; node != NULL; node = node->next) + for_each_xml_child_node(node, rootNode) { if (!xmlStrEqual(node->name, BAD_CAST "option")) continue; |