From: Jakub Skoczen Date: Tue, 7 May 2013 15:24:17 +0000 (+0200) Subject: Avoid some re-alloc X-Git-Tag: v1.3.59~57^2~15 X-Git-Url: http://lists.indexdata.dk/cgi-bin?a=commitdiff_plain;h=100c5228470dc9e35d400d7ab641d5064d2079b1;hp=58a90ea3da0cae8b9b198034736cc505e1f8273a;p=metaproxy-moved-to-github.git Avoid some re-alloc --- 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; }