diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-06-13 08:52:55 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-06-13 08:52:55 (GMT) |
commit | 053e9bc973fbe88fc41a34064ffadc0deabac58d (patch) | |
tree | 6aeee286577159ffcb612d41972a9d18ab685c6d /src/uscxml/debug/InterpreterIssue.cpp | |
parent | 6e13c7b6e0888323223afd5d2e36e86243df57af (diff) | |
download | uscxml-053e9bc973fbe88fc41a34064ffadc0deabac58d.zip uscxml-053e9bc973fbe88fc41a34064ffadc0deabac58d.tar.gz uscxml-053e9bc973fbe88fc41a34064ffadc0deabac58d.tar.bz2 |
Fixed dozens of memory leaks
Diffstat (limited to 'src/uscxml/debug/InterpreterIssue.cpp')
-rw-r--r-- | src/uscxml/debug/InterpreterIssue.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/uscxml/debug/InterpreterIssue.cpp b/src/uscxml/debug/InterpreterIssue.cpp index 86947c1..49d31c8 100644 --- a/src/uscxml/debug/InterpreterIssue.cpp +++ b/src/uscxml/debug/InterpreterIssue.cpp @@ -38,18 +38,14 @@ InterpreterIssue::InterpreterIssue(const std::string& msg, DOMNode* node, IssueS } // find all elements in the SCXML namespace in one traversal -void assembleNodeSets(const std::string nsPrefix, DOMNode* node, std::map<std::string, std::list<DOMElement*> >& sets) { - DOMNodeList* childs = node->getChildNodes(); - for (unsigned int i = 0; i < childs->getLength(); i++) { - if (childs->item(i)->getNodeType() != DOMNode::ELEMENT_NODE) - continue; - // std::cout << TAGNAME(childs.item(i)) << std::endl; +void assembleNodeSets(const std::string nsPrefix, DOMElement* node, std::map<std::string, std::list<DOMElement*> >& sets) { + for (auto childElem = node->getFirstElementChild(); childElem; childElem = childElem->getNextElementSibling()) { - if (TAGNAME_CAST(childs->item(i)).find(nsPrefix) == 0) { + if (TAGNAME(childElem).find(nsPrefix) == 0) { // correct namespace, insert via localname - sets[LOCALNAME_CAST(childs->item(i))].push_back(static_cast<DOMElement*>(childs->item(i))); + sets[LOCALNAME(childElem)].push_back(static_cast<DOMElement*>(childElem)); } - assembleNodeSets(nsPrefix, childs->item(i), sets); + assembleNodeSets(nsPrefix, childElem, sets); } } @@ -61,11 +57,7 @@ std::list<std::set<const DOMElement* > > getAllConfigurations(const DOMElement* std::cout << *root; - DOMNodeList* children = root->getChildNodes(); - for (size_t i = 0; i < children->getLength(); i++) { - if (children->item(i)->getNodeType() != DOMNode::ELEMENT_NODE) - continue; - DOMElement* childElem = static_cast<DOMElement*>(children->item(i)); + for (auto childElem = root->getFirstElementChild(); childElem; childElem = childElem->getNextElementSibling()) { std::cout << *childElem; if (XMLString::compareIString(childElem->getTagName(), X(nsPrefix + "state")) == 0 || |