On 13.11.2012 09:21, Alex Rousskov wrote:
> On 11/03/2012 05:55 AM, Kinkie wrote:
>
>> Feature-branch is at lp:~kinkie/squid/stringng
>
>
> Found one or two more bugs and a few nits:
>
<snip>
>> + message = static_cast<char*>(xmalloc(buf.length()+1));
>> + buf.copy(message,buf.length());
>> + message[buf.length()]='\0';
>
> This code can be simplified by writing:
>
> message = xstrdup(buf.c_str());
Two reasons, by importance:
1) using buf.c_str() will require terminating buf.content(), possibly
with a termination cow() which can be avoided by using this inline copy
2) one of the goals of SBuf rollout is to erase xstrdup() and its
null-terminated requirement from Squid.
Amos
Received on Mon Nov 12 2012 - 22:40:35 MST
This archive was generated by hypermail 2.2.0 : Tue Nov 13 2012 - 12:00:06 MST