]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Optimization: clientBeginRequest() call copied streamData ptr (#1797)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Wed, 1 May 2024 11:57:22 +0000 (11:57 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 1 May 2024 11:57:37 +0000 (11:57 +0000)
Detected by Coverity. CID 1529581: Unnecessary object copies can affect
performance (COPY_INSTEAD_OF_MOVE).

src/client_side_request.cc
src/client_side_request.h
src/esi/Include.cc

index 2133db3790d50b239247ed0e5fbe3c782093abd8..9ba7b182fcbcd3805470cabf6fdbfa29dea1c5fd 100644 (file)
@@ -278,8 +278,8 @@ ClientHttpRequest::~ClientHttpRequest()
  * determined by the user
  */
 int
-clientBeginRequest(const HttpRequestMethod& method, char const *url, CSCB * streamcallback,
-                   CSD * streamdetach, ClientStreamData streamdata, HttpHeader const *header,
+clientBeginRequest(const HttpRequestMethod &method, char const *url, CSCB *streamcallback,
+                   CSD *streamdetach, const ClientStreamData &streamdata, const HttpHeader *header,
                    char *tailbuf, size_t taillen, const MasterXaction::Pointer &mx)
 {
     size_t url_sz;
index 62aedda1ed1631081c68ede5cc98231d6c4987d1..e35962564cdde2aa2f078bce95b89b60e1dcfacb 100644 (file)
@@ -28,7 +28,7 @@ class ConnStateData;
 class MemObject;
 
 /* client_side_request.c - client side request related routines (pure logic) */
-int clientBeginRequest(const HttpRequestMethod&, char const *, CSCB *, CSD *, ClientStreamData, HttpHeader const *, char *, size_t, const MasterXactionPointer &);
+int clientBeginRequest(const HttpRequestMethod &, char const *, CSCB *, CSD *, const ClientStreamData &, const HttpHeader *, char *, size_t, const MasterXactionPointer &);
 
 class ClientHttpRequest
 #if USE_ADAPTATION
index dad4b4df15d3e51f15ed3e20289b416d32b2163b..efd6759e7c18e2c639e5de2e0e7b15371884dabc 100644 (file)
@@ -283,7 +283,7 @@ ESIInclude::Start (ESIStreamContext::Pointer stream, char const *url, ESIVarStat
 
     debugs(86, 5, "ESIIncludeStart: Starting subrequest with url '" << tempUrl << "'");
     const auto mx = MasterXaction::MakePortless<XactionInitiator::initEsi>();
-    if (clientBeginRequest(Http::METHOD_GET, tempUrl, esiBufferRecipient, esiBufferDetach, stream.getRaw(), &tempheaders, stream->localbuffer->buf, HTTP_REQBUF_SZ, mx)) {
+    if (clientBeginRequest(Http::METHOD_GET, tempUrl, esiBufferRecipient, esiBufferDetach, stream, &tempheaders, stream->localbuffer->buf, HTTP_REQBUF_SZ, mx)) {
         debugs(86, DBG_CRITICAL, "ERROR: starting new ESI subrequest failed");
     }