Re: [PATCH] SBuf conversion of HttpRequestMethod

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Tue, 08 Apr 2014 22:23:38 +1200

On 8/04/2014 9:36 p.m., Kinkie wrote:
> On Tue, Apr 8, 2014 at 5:45 AM, Amos Jeffries wrote:
>>
>> Add mk-sbuf-strings.awk script to produce a global array of SBuf for the
>> string objects of registered methods. This can be re-used to convert
>> other enum name arrays as we go forward.
>>
>> Use an SBuf to store unknown method names "image". Including a few
>> string comparison upgrades.
>>
>> Removes use of RequestMethodStr() wrapper in debugs to reduce the amount
>> of overheads calling c_str() when debug printing method strings.
>
> Hi,
> can't we have RequestMethodStr just return a SBuf?

There are a lot of places using its output to plug straight into
printf-style %s parameters which need to do the ugly SBuf(X).c_str()
conversion.
RequestMethodStr() was the wrapper used to translate between the old
String member and that code. I removed the uses which made no sense
(debugs) but decided to otherwise re-use it until that other code is
updated.

>
> In the awk script:
> /^namespace [a-zA-Z]+/
> What about
> /^namespace *[a-zA-Z]+/
> (multiple whitespaces are bad form, but are legal)

We do not permit them, or astyle may be removing. The script is
cut-n-paste from the c-string one.

Only changes are the array type+name and entries wrapped in SBuf() ctor's.

>
> Apart from that, LGTM
>

Amos
Received on Tue Apr 08 2014 - 10:23:48 MDT

This archive was generated by hypermail 2.2.0 : Tue Apr 08 2014 - 12:00:12 MDT