Merge pull request #5819 from Icinga/feature/avoid-func-call-allocations

Avoid unnecessary allocations in the FunctionCallExpression class
This commit is contained in:
Gunnar Beutner 2017-11-29 14:24:46 +01:00 committed by GitHub
commit c6e36723d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -428,6 +428,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
if (vfunc.IsObjectType<Type>()) {
std::vector<Value> arguments;
arguments.reserve(m_Args.size());
for (Expression *arg : m_Args) {
ExpressionResult argres = arg->Evaluate(frame);
CHECK_RESULT(argres);
@ -447,6 +448,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin
BOOST_THROW_EXCEPTION(ScriptError("Function is not marked as safe for sandbox mode.", m_DebugInfo));
std::vector<Value> arguments;
arguments.reserve(m_Args.size());
for (Expression *arg : m_Args) {
ExpressionResult argres = arg->Evaluate(frame);
CHECK_RESULT(argres);