]> git.ipfire.org Git - thirdparty/squid.git/commit
Maintenance: No ptr copy in future CredentialsCache::insert()s (#1807)
authorFrancesco Chemolli <5175948+kinkie@users.noreply.github.com>
Sun, 5 May 2024 17:16:30 +0000 (17:16 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 5 May 2024 17:16:34 +0000 (17:16 +0000)
commite5827d49897d63445b274025d1ab5acca60bb281
treeeeeefeb3da31ea666c385896f5c5f39bcdbca911
parentffe9533724a49adebe7656142b9ef82b0ea053b7
Maintenance: No ptr copy in future CredentialsCache::insert()s (#1807)

Currently, the insert() method calls implicitly convert raw "this"
pointers to RefCount pointers. That self-registration code raises red
flags and may eventually be refactored. If it is refactored, insert()
calls are likely to start using RefCount pointers as parameters. This
change allows those future calls to avoid RefCount pointer copies. This
change does not affect current calls performance.

This change was triggered by Coverity CID 1554665: Unnecessary object
copies can affect performance (COPY_INSTEAD_OF_MOVE). However, the
insert() method is still calling RefCount copy assignment operator
rather than its (cheaper) move assignment operator. Safely removing that
overhead is only possible by reintroducing future parameter copying
overhead described above _and_ using an explicit std::move() call that
we are trying to avoid in general code. It is arguably not worth it.
src/auth/CredentialsCache.cc
src/auth/CredentialsCache.h