[PATCH 10/33] mtd: Rename free() to rfree()

Simon Glass sjg at chromium.org
Wed Feb 12 18:14:28 CET 2020


Hi Masahiro,

On Wed, 12 Feb 2020 at 06:14, Masahiro Yamada <masahiroy at kernel.org> wrote:
>
> On Mon, Jan 13, 2020 at 4:08 AM Simon Glass <sjg at chromium.org> wrote:
> >
> > This function name conflicts with our desire to #define free() to
> > something else on sandbox. Since it deals with resources, rename it to
> > rfree().
> >
> > Signed-off-by: Simon Glass <sjg at chromium.org>
>
>
> I noticed this commit was merged recently.
>
> Now 'free' is a reserved keyword
> you cannot use in U-Boot.
>
>
> Commit cc92c3c thru cf23c7c are horrible.
>
>
> Commit cfda60f should have used
> 'static inline' instead of #define.
>
> I cannot believe it.

Are you sure you understand the problem I was trying to solve? I am
using dlmalloc's existing means of adding a prefix, but I'm sure we
could change it to another way.

If we define malloc() as dlmalloc() in dlmalloc.c, then we could add a
declaration in dlmalloc.h that uses static inline to convert calls to
malloc() to call dlmalloc(). Then anything that doesn't include
malloc.h would still call the C library malloc(). Is that what you are
thinking?

I did look at using a link script instead but it is pretty messy.

What do you mean by 'free' being a reserved keyword? Where? So is
'rfree' a good substitute or do you suggest something else?

Regards,
Simon


More information about the U-Boot mailing list