tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: reallocarr(3)
Joerg Sonnenberger wrote:
> On Thu, Feb 05, 2015 at 10:27:22PM +0100, Kamil Rytarowski wrote:
> > For a safe function I propose to trigger ENOTSUP.
>
> That's just bad as creates a needless set of complications for
> functions. Consider a function that pops elements of the end of a
> dynamic array. With your proposal, you can't just resize the array at
> the end of a loop without having to check for emptiness before.
>
> Joerg
>
You are right (at least for the num parameter). free(3) is fine then.
Does memcpy(3) promise to preserve errno?
My last suggestion is to move saved_errno = errno; before memcpy.
And indeed, move reallocarray(3) to the _OPENBSD_SOURCE namespace.
Regards,
Home |
Main Index |
Thread Index |
Old Index