[PATCH 1/8] malloc: implement USE_DL_PREFIX via inline functions

Simon Glass sjg at chromium.org
Thu Feb 20 04:05:06 CET 2020


On Wed, 19 Feb 2020 at 12:39, Simon Goldschmidt
<simon.k.r.goldschmidt at gmail.com> wrote:
>
> Commit cfda60f99ae2 ("sandbox: Use a prefix for all allocation functions")
> introduced preprocessor macros for malloc/free etc.
>
> This is bad practice as it essentially makes 'free' a reserved keyword and
> resulted in quite a bit of renaming to avoid that reserved keyword.
>
> A better solution is to define the allocation functions as 'static inline'.
>
> As a side effect, exports.h must not export malloc/free for sandbox.
>
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt at gmail.com>
> ---
>
> A side-effect is that exports.h may not declare malloc/free. I'm not really
> sure if this is correct, but for sandbox, it should probably be ok?

Is it possible to fix this? E.g. don't use inline for these two
functions on sandbox?

>
>  include/_exports.h |  2 ++
>  include/exports.h  |  2 ++
>  include/malloc.h   | 44 +++++++++++++++++++++++++++++---------------
>  3 files changed, 33 insertions(+), 15 deletions(-)

Reviewed-by: Simon Glass <sjg at chromium.org>


More information about the U-Boot mailing list