]> Savannah Git Hosting - gnulib.git/commit
realloc-posix: tune for glibc-like
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Nov 2024 02:16:50 +0000 (18:16 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 5 Nov 2024 05:40:19 +0000 (21:40 -0800)
commitc2df016cce0130dc844c9798741438bf6a0c5a8a
treef80e2e9d7a9ca55c70024de98538a40ecd911b87
parent4f5e558f94add54790805ac10bfa4dbe076cc0b6
realloc-posix: tune for glibc-like

For glibc, implementing realloc (p, s) as realloc (p, s?s:1) suffices,
and it’s probably better to do it inline to aid static checking.
* lib/realloc.c (rpl_realloc) [_GL_INLINE_RPL_REALLOC]:
Remove, replacing with inline function in stdlib.h.
* lib/stdlib.in.h (_GL_INLINE_RPL_REALLOC): New macro.
(rpl_realloc): Define as inline if _GL_INLINE_RPL_REALLOC.
* m4/realloc.m4 (gl_FUNC_REALLOC_0_NONNULL):
Set REPLACE_REALLOC_FOR_REALLOC_POSIX=2 instead of 1,
if it’s close enough to glibc that the inline optimization is valid.
ChangeLog
lib/realloc.c
lib/stdlib.in.h
m4/realloc.m4