Re: [PATCH newlib] libc/include/malloc.h: Add prototype for GNU extension malloc_usable_size()

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCXF9DM7S7-HC4BkzagaL1HD1Dizx2+ACaTS=e2K06A6fA@mail.gmail.com>
On Tue, Mar 15, 2022, 1:43 PM Sebastian Huber <
[email protected]> wrote:

> On 15/03/2022 16:47, Mike Frysinger wrote:
> > On 15 Mar 2022 10:16, Joel Sherrill wrote:
> >> This is not provided by the newlib malloc implementation but may
> >> be available in external implementations.
> >> ---
> >>   newlib/libc/include/malloc.h | 4 ++++
> >>   1 file changed, 4 insertions(+)
> >>
> >> diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h
> >> index a9dc5bca6..e73095e1e 100644
> >> --- a/newlib/libc/include/malloc.h
> >> +++ b/newlib/libc/include/malloc.h
> >> @@ -137,6 +137,10 @@ extern void __malloc_lock(struct _reent *);
> >>
> >>   extern void __malloc_unlock(struct _reent *);
> >>
> >> +#if __GNU_VISIBLE
> >> +extern size_t malloc_usable_size(void *);
> >> +#endif
> >> +
> > i'm confused.  isn't this prototype already defined in this header file
> > on line 101 above where you added this ?
>
> Yes, and it is implemented by the Newlib malloc.
>

Thanks Sebastian. Good catch.

The prototype isn't wrapped by __GNU_VISIBLE. Should it be?

--joel

>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: [email protected]
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.