0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

ServerPushList : optimize reserve() call in parse() method,

and add extend() method.
This commit is contained in:
James Yonan 2016-10-31 15:22:25 -07:00
parent 1c302cde29
commit 32d1b9d714

View File

@ -40,16 +40,23 @@ namespace openvpn {
const auto* push = opt.get_index_ptr(opt_name);
if (push)
{
reserve(push->size());
for (auto &i : *push)
{
const Option& o = opt[i];
o.touch();
push_back(o.get(1, 512));
}
reserve(size() + push->size());
for (auto &i : *push)
{
const Option& o = opt[i];
o.touch();
push_back(o.get(1, 512));
}
}
}
void extend(const std::vector<std::string>& other)
{
reserve(size() + other.size());
for (auto &e : other)
push_back(e);
}
// do a roundtrip to csv and back to OptionList
OptionList to_option_list() const
{