[musl] Re: realloci(): A realloc() variant that works in-place
Collin Funk
collin.funk1@gmail.com
Sat Nov 1 18:20:13 GMT 2025
Rich Felker <dalias@libc.org> writes:
>> Where realloci() allocates at least 'size' bytes (but possibly more),
>> and returns the actual usable size of the block. So, you could
>>
>> realloci(p, 3000);
>>
>> and it would return for example 4096, which would be the usable size of
>> the block. Or it would return -1 if it is unable to grow that much.
>> realloci() would never fail when shrinking, as it could just return a
>> larger size and be done with it.
>
> ssize_t is POSIX-only and unlikely to be adopted by C standard. It
> could return (size_t)-1 instead.
ptrdiff_t probably makes more sense for allocation sizes anyways.
Collin
More information about the Libc-alpha
mailing list