tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Reuse strtonum(3) and reallocarray(3) from OpenBSD



Joerg Sonnenberger wrote
> As with strtonum, reallocarray has enough problems of its own. While it
> fixes the problem of overflows, it doesn't handle the problem of failing
> allocations gracefully. If you don't want to make that fatal or leak
> memory, you still have to use a separate variable. Another issue is that
> the API as it is doesn't properly deal with zero sized allocations. In
> short, this API is once again not nearly as useful as it could be and
> not something I want to see in libc...
> 
> Joerg
> 

Thank you for your feedback. These functions are meant to handle the overflow class of bugs, otherwise they are equivalent to the standard libc functions.

A graceful failing of allocations is domain specific (panic, exit, recover, sleep, ...).

Please propose an alternative.


Home | Main Index | Thread Index | Old Index