[squid-dev] [RFC] Refactor HttpHeader

Kinkie gkinkie at gmail.com
Fri Jul 31 19:40:27 UTC 2015


Hi,
  the hard part is IMO done, should be enough for a first round of review;
I've left the TODO list I discussed with Amos on IRC in to keep track of
what's been done. There are two things left that I can think of: getting
rid of the masks (ListHeadersMask etc) in favor of bools or bitfields in
the headersTable (I'd go for bools for speed, I believe we can afford to
waste 100-ish bytes per flag), and possibly switching some enums  to c++11
strongly-typed enums (enum class foo) in some places.

Code has been casually run-tested, seems to be OK.

On Thu, Jul 30, 2015 at 9:44 PM, Kinkie <gkinkie at gmail.com> wrote:

>
>
> On Thu, Jul 30, 2015 at 6:42 PM, Alex Rousskov <
> rousskov at measurement-factory.com> wrote:
>
>> On 07/30/2015 01:44 AM, Kinkie wrote:
>>
>> > headerDescription: a std::vector keyed by header ID containing header
>> type
>>
>> HeaderDescriptions (plural) then.
>>
>
> Ok, will change.
>
>
>> > template <typename EnumType>
>> > typedef struct LookupTableRecord
>> > {
>> >    const char *name;
>> >    EnumType id;
>> > }
>>
>> Please avoid "struct" whenever possible. Typing "public:" once is better
>> that always remembering whether to search for and forward-declare a
>> "struct Foo" or a "class Foo".
>>
>
> Sure.
>
>
>> > template<typename Enumtype, typename RecordType =
>> > LookupTableRecord<EnumType> >
>> > class LookupTable
>> > {
>> >    //...
>> > }
>> >
>> > This would make it so that someone could define a custom Record type,
>> > and as long as that record type matches the signature of
>> > LookupTableRecord, LookupTable won't care.
>>
>> Do not add that template parameter until you actually need to customize
>> the record type. If you end up using this design, just typedef Record to
>> be LookupTableRecord.
>>
>
> Need is already present; it's done exactly as you say.
> Thanks!
>
> --
>     Francesco
>



-- 
    Francesco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150731/f968891e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coverity-fixes-4-v1.patch
Type: text/x-patch
Size: 47037 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20150731/f968891e/attachment-0001.bin>


More information about the squid-dev mailing list