Skip to content

Commit

Permalink
[ruby/prism] Only define xallocator when not defined
Browse files Browse the repository at this point in the history
  • Loading branch information
kddnewton authored and matzbot committed Mar 4, 2024
1 parent 6ad0f89 commit f7adee3
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions prism/defines.h
Expand Up @@ -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

0 comments on commit f7adee3

Please sign in to comment.