Removes copy form VariableValue

On `Use std::shared_ptr for variable resolution` @WGH changes
VariableValue to be a shared_ptr. As shared pointer, the copy
on AnchoredVariable is no longer necessary. The copy was removed
along with the copy constructor.
This commit is contained in:
Felipe Zimmerle
2020-08-26 09:18:36 -03:00
parent 60d89608be
commit c7f3c9eef0
3 changed files with 11 additions and 24 deletions

View File

@@ -79,7 +79,7 @@ class AnchoredVariable {
std::string m_value;
private:
VariableValue m_var;
std::shared_ptr<VariableValue> m_var;
};
} // namespace modsecurity

View File

@@ -60,20 +60,7 @@ class VariableValue {
m_value(*value)
{ }
VariableValue(const VariableValue &o) :
m_collection(o.m_collection),
m_key(o.m_key),
m_keyWithCollection(o.m_keyWithCollection),
m_value(o.m_value)
{
for (auto &i : o.m_orign) {
VariableOrigin *origin(new VariableOrigin());
origin->m_offset = i.m_offset;
origin->m_length = i.m_length;
m_orign.push_back(*origin);
}
}
VariableValue(const VariableValue &o) = delete;
const std::string& getName() const noexcept {
return m_keyWithCollection;