From: Francesco Chemolli Date: Thu, 25 Feb 2016 16:43:21 +0000 (+0100) Subject: avoid unnecessary SBuf copies X-Git-Tag: SQUID_4_0_8~60^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a32d75e76e97c43926c713e31cd50f31b6e12457;p=thirdparty%2Fsquid.git avoid unnecessary SBuf copies --- diff --git a/src/acl/HttpHeaderData.cc b/src/acl/HttpHeaderData.cc index db1fbd22e8..2903eb9f36 100644 --- a/src/acl/HttpHeaderData.cc +++ b/src/acl/HttpHeaderData.cc @@ -52,7 +52,7 @@ ACLHTTPHeaderData::match(HttpHeader* hdr) return false; } - SBuf cvalue(StringToSBuf(value)); + auto cvalue = StringToSBuf(value); return regex_rule->match(cvalue.c_str()); } diff --git a/src/acl/Note.cc b/src/acl/Note.cc index 50f666e420..35e43318f4 100644 --- a/src/acl/Note.cc +++ b/src/acl/Note.cc @@ -37,7 +37,7 @@ ACLNoteStrategy::matchNotes(ACLData *noteData, const NotePairs *note, for (auto &entry: note->entries) { if (delimiters) { NotePairs::Entry e(entry->name.termedBuf(), ""); - Parser::Tokenizer t(SBuf(StringToSBuf(entry->value))); + Parser::Tokenizer t(StringToSBuf(entry->value)); SBuf s; while (t.token(s, *delimiters)) { e.value = s.c_str(); diff --git a/src/adaptation/Iterator.cc b/src/adaptation/Iterator.cc index 37bce3483d..7cfa060f8f 100644 --- a/src/adaptation/Iterator.cc +++ b/src/adaptation/Iterator.cc @@ -63,7 +63,7 @@ void Adaptation::Iterator::start() request = theCause; Must(request); Adaptation::History::Pointer ah = request->adaptHistory(true); - SBuf gid(StringToSBuf(theGroup->id)); + auto gid = StringToSBuf(theGroup->id); ah->recordAdaptationService(gid); } @@ -103,7 +103,7 @@ void Adaptation::Iterator::step() if (Adaptation::Config::needHistory) { Adaptation::History::Pointer ah = request->adaptHistory(true); - SBuf uid(StringToSBuf(thePlan.current()->cfg().key)); + auto uid = StringToSBuf(thePlan.current()->cfg().key); ah->recordAdaptationService(uid); } diff --git a/src/mgr/ActionParams.cc b/src/mgr/ActionParams.cc index 6488a06218..7cf8421714 100644 --- a/src/mgr/ActionParams.cc +++ b/src/mgr/ActionParams.cc @@ -39,7 +39,7 @@ void Mgr::ActionParams::pack(Ipc::TypedMsgHdr &msg) const { msg.putString(httpUri); - String foo(SBufToString(httpMethod.image())); + auto foo = SBufToString(httpMethod.image()); msg.putString(foo); msg.putPod(httpFlags); msg.putString(httpOrigin);