summaryrefslogtreecommitdiffstats
path: root/src/Config.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-05-01 17:48:32 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-05-06 15:18:03 +0200
commit47fe3421585302f2101691a685ab99b0e1ad5cfc (patch)
tree5f7ff204c5d19f83313487a840748724e04ad8e5 /src/Config.cpp
parentbf31003d74f538a9096ef5999b31b0daa58c38c9 (diff)
downloadastra-47fe3421585302f2101691a685ab99b0e1ad5cfc.tar.gz
astra-47fe3421585302f2101691a685ab99b0e1ad5cfc.tar.bz2
astra-47fe3421585302f2101691a685ab99b0e1ad5cfc.tar.xz
astra-47fe3421585302f2101691a685ab99b0e1ad5cfc.zip
Change XMLNode* to XMLNode
An XMLNode object is already simply a pointer, so no need to dynamically allocate XMLNodes.
Diffstat (limited to 'src/Config.cpp')
-rw-r--r--src/Config.cpp19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/Config.cpp b/src/Config.cpp
index 32e5ed9..395080b 100644
--- a/src/Config.cpp
+++ b/src/Config.cpp
@@ -45,15 +45,14 @@ using namespace std;
//-----------------------------------------------------------------------------
// default constructor
-Config::Config()
+Config::Config() : self()
{
- self = 0;
_doc = 0;
}
//-----------------------------------------------------------------------------
// not so default constructor
-Config::Config(XMLNode* _self)
+Config::Config(XMLNode _self)
{
self = _self;
_doc = 0;
@@ -62,8 +61,6 @@ Config::Config(XMLNode* _self)
//-----------------------------------------------------------------------------
Config::~Config()
{
- delete self;
- self = 0;
delete _doc;
_doc = 0;
}
@@ -71,7 +68,7 @@ Config::~Config()
//-----------------------------------------------------------------------------
void Config::initialize(std::string rootname)
{
- if (self == 0) {
+ if (!self) {
XMLDocument* doc = XMLDocument::createDocument(rootname);
self = doc->getRootNode();
_doc = doc;
@@ -129,13 +126,13 @@ bool ConfigStackCheck<T>::stopParsing()
std::string errors;
- std::list<XMLNode*> nodes = cfg->self->getNodes();
- for (std::list<XMLNode*>::iterator i = nodes.begin(); i != nodes.end(); ++i)
+ std::list<XMLNode> nodes = cfg->self.getNodes();
+ for (std::list<XMLNode>::iterator i = nodes.begin(); i != nodes.end(); ++i)
{
- std::string nodeName = (*i)->getName();
+ std::string nodeName = i->getName();
if (nodeName == "Option") {
- nodeName = (*i)->getAttribute("key", "");
+ nodeName = i->getAttribute("key", "");
if (object->configCheckData->parsedOptions.find(nodeName) == object->configCheckData->parsedOptions.end()) {
if (!errors.empty()) errors += ", ";
errors += nodeName;
@@ -147,8 +144,6 @@ bool ConfigStackCheck<T>::stopParsing()
}
}
}
- for (std::list<XMLNode*>::iterator i = nodes.begin(); i != nodes.end(); ++i)
- delete (*i);
nodes.clear();
if (!errors.empty()) {