[squid-dev] [PATCH] shuffle remaining session cache code to libsecurity
Amos Jeffries
squid3 at treenet.co.nz
Sat Apr 29 08:45:36 UTC 2017
On 27/04/17 11:20, Alex Rousskov wrote:
> On 04/26/2017 07:01 AM, Amos Jeffries wrote:
>
>> +#if USE_OPENSSL // while Ssl:: bits in use
>> +static const char *SessionCacheName = "tls_session_cache";
>> +static Ipc::MemMap *SessionCache = nullptr;
>> +#endif
> What does the above comment mean? I could not guess based on a few other
> occurrences of the same comment, and I do not see any "Ssl::" bits in
> the above code.
Oops, just me missing that after copying the functions that used these
globals over. Will remove before commit.
>> + if (auto *slotW = SessionCache->openForWriting((const cache_key*)key, pos)) {
> In general, I recommend removing "*" after "auto" because the condition
> and the code protected by it does not care whether the variable is a raw
> pointer, a smart pointer, or (in some cases) something else with a
> to-boolean conversion.
Okay, good point.
> "auto" needs "const" and "&" but not "*".
FYI: that statement does not match my experiences with auto in the
general case. I have in the past omitted these sugar type details and
found that the compiler picked to use the object copy-assignment to
duplicate the object into the 'auto' variable. That may just have been
compiler bugs, but is a nasty one anyway. So I prefer to only replace
the type name with auto to ensure that implicit conversions are kept to
minimal or performant ones and the nature of the variable remains
visible to us reading it.
Amos
More information about the squid-dev
mailing list