From 100c5228470dc9e35d400d7ab641d5064d2079b1 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Tue, 7 May 2013 17:24:17 +0200 Subject: [PATCH] Avoid some re-alloc --- src/filter_http_rewrite.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/filter_http_rewrite.cpp b/src/filter_http_rewrite.cpp index 86667ca..249a757 100644 --- a/src/filter_http_rewrite.cpp +++ b/src/filter_http_rewrite.cpp @@ -200,9 +200,8 @@ const std::string yf::HttpRewrite::search_replace( = groups_bynum.find(i); if (it != groups_bynum.end()) { //it is - std::string name = it->second; if (!what[i].str().empty()) - vars[name] = what[i]; + vars[it->second] = what[i]; } } @@ -210,12 +209,13 @@ const std::string yf::HttpRewrite::search_replace( std::string rvalue = sub_vars(uri_pat, vars); yaz_log(YLOG_LOG, "! Rewritten '%s' to '%s'", what.str(0).c_str(), rvalue.c_str()); - out += std::string(start, what[0].first) + rvalue; + out.append(start, what[0].first); + out.append(rvalue); start = what[0].second; //move search forward } //if we had a match cat the last part if (start != txt.begin()) - out += std::string(start, end); + out.append(start, end); return out; } -- 1.7.10.4