From f7adee34a33c825eef40cf803ebb83f46ff8fc77 Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Mon, 4 Mar 2024 11:49:09 -0500 Subject: [PATCH] [ruby/prism] Only define xallocator when not defined https://github.com/ruby/prism/commit/919d682379 --- prism/defines.h | 54 ++++++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/prism/defines.h b/prism/defines.h index f458f7f6e77376..5995d54cb8d941 100644 --- a/prism/defines.h +++ b/prism/defines.h @@ -145,29 +145,37 @@ #ifdef PRISM_XALLOCATOR #include "prism_xallocator.h" #else - /** - * The malloc function that should be used. This can be overriden with the - * PRISM_XALLOCATOR define. - */ - #define xmalloc malloc - - /** - * The realloc function that should be used. This can be overriden with the - * PRISM_XALLOCATOR define. - */ - #define xrealloc realloc - - /** - * The calloc function that should be used. This can be overriden with the - * PRISM_XALLOCATOR define. - */ - #define xcalloc calloc - - /** - * The free function that should be used. This can be overriden with the - * PRISM_XALLOCATOR define. - */ - #define xfree free + #ifndef xmalloc + /** + * The malloc function that should be used. This can be overriden with + * the PRISM_XALLOCATOR define. + */ + #define xmalloc malloc + #endif + + #ifndef xrealloc + /** + * The realloc function that should be used. This can be overriden with + * the PRISM_XALLOCATOR define. + */ + #define xrealloc realloc + #endif + + #ifndef xcalloc + /** + * The calloc function that should be used. This can be overriden with + * the PRISM_XALLOCATOR define. + */ + #define xcalloc calloc + #endif + + #ifndef xfree + /** + * The free function that should be used. This can be overriden with the + * PRISM_XALLOCATOR define. + */ + #define xfree free + #endif #endif #endif