| 
  | 
Message-ID: <udilha5k7qxuybbl45ed3mfpqhjqbbun4aq73nxormxjcxegwt@oxmctlkoljjz>
Date: Sat, 1 Nov 2025 10:25:08 +0100
From: Alejandro Colomar <alx@...nel.org>
To: Rich Felker <dalias@...c.org>
Cc: musl@...ts.openwall.com, "A. Wilcox" <AWilcox@...cox-tech.com>, 
	Lénárd Szolnoki <cpp@...ardszolnoki.com>, Thorsten Glaser <tg@...bsd.de>, 
	Collin Funk <collin.funk1@...il.com>
Subject: Re: [RFC] add realloci() and reallocarrayi()
Hi Rich,
On Fri, Oct 31, 2025 at 09:02:09PM -0400, Rich Felker wrote:
> > diff --git a/ldso/dynlink.c b/ldso/dynlink.c
> > index 715948f4..a882c5c1 100644
> > --- a/ldso/dynlink.c
> > +++ b/ldso/dynlink.c
> > @@ -35,6 +35,7 @@ static size_t ldso_page_size;
> >  #define malloc __libc_malloc
> >  #define calloc __libc_calloc
> >  #define realloc __libc_realloc
> > +#define realloci __libc_realloci
> >  #define free __libc_free
> 
> These gratuitous changes all over are not needed. realloci would never
> be used internally so there's no reason to remap it or make a
> libc-internal version of it. Same reason as for aligned_alloc, etc.
> which aren't macro-redirected.
Thanks!  I wasn't sure what that was for.
> > diff --git a/src/malloc/mallocng/realloc.c b/src/malloc/mallocng/realloc.c
> > index 18769f42..92f8eea5 100644
> > --- a/src/malloc/mallocng/realloc.c
> > +++ b/src/malloc/mallocng/realloc.c
> > @@ -15,15 +15,9 @@ void *realloc(void *p, size_t n)
> >  	unsigned char *start = g->mem->storage + stride*idx;
> >  	unsigned char *end = start + stride - IB;
> >  	size_t old_size = get_nominal_size(p, end);
> > -	size_t avail_size = end-(unsigned char *)p;
> >  	void *new;
> >  
> > -	// only resize in-place if size class matches
> > -	if (n <= avail_size && n<MMAP_THRESHOLD
> > -	    && size_to_class(n)+1 >= g->sizeclass) {
> > -		set_size(p, end, n);
> > -		return p;
> > -	}
> > +	if (realloci(p, n) == 0) return p;
> 
> This is a namespace violation. realloc can't depend on realloci.
Okay.  Thanks!
> 
> Rich
Have a lovely day!
Alex
-- 
<https://www.alejandro-colomar.es>
Use port 80 (that is, <...:80/>).
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.