Avoids string copy by working with pointers while resolving variables

This commit is contained in:
Felipe Zimmerle
2016-12-27 15:25:11 -03:00
parent 7834cf857b
commit a7f465cf3a
38 changed files with 179 additions and 94 deletions

View File

@@ -73,8 +73,7 @@ void XML::evaluateInternal(Transaction *t,
/* Invocation without an XPath expression makes sense
* with functions that manipulate the document tree.
*/
l->push_back(new collection::Variable("XML",
std::string("[XML document tree]" + param)));
l->push_back(new collection::Variable(&m_name, &m_plain));
return;
}
@@ -124,8 +123,9 @@ void XML::evaluateInternal(Transaction *t,
content = reinterpret_cast<char *>(
xmlNodeGetContent(nodes->nodeTab[i]));
if (content != NULL) {
l->push_back(new collection::Variable(m_name,
std::string(content)));
// FIXME: Memory leak
l->push_back(new collection::Variable(&m_name,
new std::string(content)));
xmlFree(content);
}
}