summaryrefslogtreecommitdiff
path: root/prism/defines.h
diff options
context:
space:
mode:
authorKevin Newton <[email protected]>2024-03-04 11:49:09 -0500
committergit <[email protected]>2024-03-04 16:49:14 +0000
commitf7adee34a33c825eef40cf803ebb83f46ff8fc77 (patch)
tree7f8e78d6eb8735fe33cd1adf3832566a45498fc4 /prism/defines.h
parent6ad0f89d5aa2466cdfcd1a056ce9b28b39245033 (diff)
[ruby/prism] Only define xallocator when not defined
https://github.com/ruby/prism/commit/919d682379
Diffstat (limited to 'prism/defines.h')
-rw-r--r--prism/defines.h54
1 files changed, 31 insertions, 23 deletions
diff --git a/prism/defines.h b/prism/defines.h
index f458f7f6e7..5995d54cb8 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