[squid-dev] [PATCH] convert CacheDigest to C++ and MEMPROXY

Kinkie gkinkie at gmail.com
Sun Nov 8 20:23:20 UTC 2015


Hi,
I'd use "contains" instead of CacheDigest::test
Apart from that, LGTM: +1.

On Fri, Nov 6, 2015 at 7:19 PM, Amos Jeffries <squid3 at treenet.co.nz> wrote:
> Convert the gobal C-style functions that operate on class CacheDigest to
> class methods in C++ style.
>
> This is largely a symbol renaming change. But there are two relatively
> small logic changes:
>
> 1) convert the class to MEMPROXY_CLASS.
>
> Which alters the pool creation timing from general memory pool
> initialization time, to whenever the CacheDigest object is first used.
>
> A nice side effect is removal the macro conditional within the old pool
> type enumeration. Macros like that in enumeration lists such as this one
> have been causing some builds to have run-time errors accessing memory
> arrays out-of-bounds or incorrect postions when the build-time
> dependency detection issues caused build objects to link with different
> ./configure'd versions.
>
>
> 2) Constructor logic sequence alteration.
>
> The old *Create function used to set some members then call the *Init
> function which would re-set some of them, and initialize most of the
> rest (but not all).
> The old *UpdateCap function would call a helper that emulated
> safe_free(mask) then *Init to alter the objects mask related members
> whether they needed it or not.
>
> The class constructor now initializes all members via initialization
> list then calls updateCapacity(), which calls a simplified init(). This
> altered sequence contains the same operational acts while the new order
> avoids repeated or unnecesarily setting members on create and update.
>
>
> Amos
>
> _______________________________________________
> squid-dev mailing list
> squid-dev at lists.squid-cache.org
> http://lists.squid-cache.org/listinfo/squid-dev
>



-- 
    Francesco


More information about the squid-dev mailing list