Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/anchored_set_variable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ namespace modsecurity {
AnchoredSetVariable::AnchoredSetVariable(Transaction *t,
const std::string &name)
: m_transaction(t),
m_name(name) {
reserve(10);
}
m_name(name) { }


AnchoredSetVariable::~AnchoredSetVariable() {
Expand All @@ -52,6 +50,9 @@ void AnchoredSetVariable::unset() {

void AnchoredSetVariable::set(const std::string &key,
const std::string &value, size_t offset, size_t len) {
if (empty()) {
reserve(10);
}
VariableValue *var = new VariableValue(&m_name, &key, &value);
var->addOrigin(len, offset);
emplace(key, var);
Expand All @@ -60,6 +61,9 @@ void AnchoredSetVariable::set(const std::string &key,

void AnchoredSetVariable::set(const std::string &key,
const std::string &value, size_t offset) {
if (empty()) {
reserve(10);
}
VariableValue *var = new VariableValue(&m_name, &key, &value);
var->addOrigin(value.size(), offset);
emplace(key, var);
Expand Down
Loading