Re: StringNG merge?

From: Kinkie <gkinkie_at_gmail.com>
Date: Tue, 18 Dec 2012 18:36:17 +0100

On Mon, Dec 17, 2012 at 11:42 PM, Amos Jeffries <squid3_at_treenet.co.nz> wrote:
> On 18.12.2012 07:39, Kinkie wrote:
>
>> On Tue, Nov 13, 2012 at 12:50 AM, Alex Rousskov wrote:
>>>
>>> On 11/12/2012 03:40 PM, Amos Jeffries wrote:
>>>>
>>>> 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
>>>>>
>>>>>
>>>>>
>
> <snip>
>
>
>>>> 2) one of the goals of SBuf rollout is to erase xstrdup() and its
>>>> null-terminated requirement from Squid.
>>>
>>>
>>> In this particular case, xmalloc() followed by manual null-termination
>>> is even worse than a simple xstrdup()!
>>
>>
>> If only xstrdup could take an optional length parameter...
>> Would you agree to extending it (or defining an xstrndup which does) ?
>
> I have no problem with that if done carefully to validate all input case
> permutations cleanly.

Actually not needed, it's already defined and useable.
I've also noticed that both xstrdup and xstrndup use a naive built-in
implementation.
I checked glibc's sources, it does some interesting low-level tricks
to copy big blocks of data (in memcpy).
Maybe we want to try and use memcpy that instead of hand-rolling in xstring.cc?

-- 
    /kinkie
Received on Tue Dec 18 2012 - 17:36:24 MST

This archive was generated by hypermail 2.2.0 : Wed Dec 19 2012 - 12:00:37 MST