From db6a1fcdb75cf9f45626cf43b4883ed3de016a6c Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Wed, 29 Nov 2017 14:11:09 +0100 Subject: [PATCH] Avoid unnecessary allocations in the FunctionCallExpression class --- lib/config/expression.cpp | 2 ++ 1 file changed, 2 insertions(+) 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);