From: Gunnar Beutner Date: Wed, 29 Nov 2017 13:11:09 +0000 (+0100) Subject: Avoid unnecessary allocations in the FunctionCallExpression class X-Git-Tag: v2.9.0~311^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=refs%2Fpull%2F5819%2Fhead;p=icinga2 Avoid unnecessary allocations in the FunctionCallExpression class --- diff --git a/lib/config/expression.cpp b/lib/config/expression.cpp index 3f95435a0..a2a75f62f 100644 --- a/lib/config/expression.cpp +++ b/lib/config/expression.cpp @@ -428,6 +428,7 @@ ExpressionResult FunctionCallExpression::DoEvaluate(ScriptFrame& frame, DebugHin if (vfunc.IsObjectType()) { std::vector 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 arguments; + arguments.reserve(m_Args.size()); for (Expression *arg : m_Args) { ExpressionResult argres = arg->Evaluate(frame); CHECK_RESULT(argres);