Hi again,

Pierre Habouzit wrote:
>> On Sat, Jul 03, 2010 at 06:30:58PM -0500, Jonathan Nieder wrote:

>>> Why not (4 + i) * sizeof(targv[0])?
>
> actually I missed that question, it's because in a previous iteration of
> the patch

Thanks for the explanation.  That’s a comfort.

>>> Needed for the !taropts case.  Good.
>
> actually this isn't really needed anymore either (before when !taropts,
> I had kept the old code, and I didn't used the malloced argv).
> memcpy(dst, src, 0) will do what it should, even when src is NULL.

What you say makes sense, so I just checked Posix to see if there were
any gotchas.  It is silent on the issue and defers to ISO C.  The C
standard itself (at least C99 TC2 from
http://www.open-std.org/jtc1/sc22/wg14/www/standards.html#9899 )
stubbornly refuses to standardize[1] on the sane behavior:

        Where an argument declared as size_t n specifies the
        length of the array for a function, n can have the value
        zero on a call to that function. Unless explicitly stated
        otherwise in the description of a particular function in
        this subclause, pointer arguments on such a call shall
        still have valid values, as described in 7.1.4.

Sadly the description of memcpy() has nothing to add.

> But it's only cosmetics of course.

Right, it’s only theoretical.  If the if is missing and people run
into problems dpkg could learn to deal with it then.

[1] Library → String handling <string.h> → String function conventions,
paragraph 2, currently numbered 7.21.1.2.  Thanks to Larry Jones from
c.l.c.m, 1996 for a pointer.


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]
Archive: http://lists.debian.org/20100705134745.ga10...@burratino

Reply via email to