On Mon, Jul 05, 2010 at 08:47:45AM -0500, Jonathan Nieder wrote:
> 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.

Yeah right, OTOH I see absolutely no-one causing a segfault is the
address insn't valid.

> > 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.

Well I don't care if the if(i) is there or not after all, it's not even
worth the discussion :)
-- 
·O·  Pierre Habouzit
··O                                                [email protected]
OOO                                                http://www.madism.org


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

Reply via email to