[PATCH 10/33] mtd: Rename free() to rfree()
simon.k.r.goldschmidt at gmail.com
Thu Feb 13 10:05:59 CET 2020
On Wed, Feb 12, 2020 at 6:14 PM Simon Glass <sjg at chromium.org> wrote:
> 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
There is no "malloc()" in dlmalloc.c. It is called "mALLOc()" and by defining
USE_DL_PREFIX, you already have converted that to be linked as "dlmalloc()".
I think there should be no difference in who calls what when converting your
defines to static inline functions.
And yes, I also dislike the other patches that remove all occurrences of
'free'. I think without knowing the backgrounds of your patches, that just
> 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?
More information about the U-Boot