From 74045beab561fb478f1047dc9427ac48a942d10f Mon Sep 17 00:00:00 2001 From: Felipe Zimmerle Date: Thu, 15 Oct 2015 14:04:35 -0300 Subject: [PATCH] Performance improvement while expanding macros --- src/macro_expansion.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/macro_expansion.cc b/src/macro_expansion.cc index 84ba18e8..b0de34cf 100644 --- a/src/macro_expansion.cc +++ b/src/macro_expansion.cc @@ -34,9 +34,15 @@ std::string MacroExpansion::expandKeepOriginal(const std::string& input, std::string MacroExpansion::expand(const std::string& input, Assay *assay) { - std::string res(input); + std::string res; + size_t pos = input.find("%{"); + + if (pos != std::string::npos) { + res = input; + } else { + return input; + } - size_t pos = res.find("%{"); while (pos != std::string::npos) { size_t start = pos; size_t end = res.find("}");