[ruby/prism] Document xallocator functions
https://github.com/ruby/prism/commit/ee1a4acacd
This commit is contained in:
parent
b95e2cdca7
commit
c0a34a6c8c
@ -126,9 +126,12 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If you build prism with a custom allocator, configure it with "-D PRISM_XALLOCATOR"
|
* If you build prism with a custom allocator, configure it with
|
||||||
* to use your own allocator that defines xmalloc, xrealloc, xcalloc, and xfree.
|
* "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc,
|
||||||
* For example, your `custom_allocator.h` file could look like this:
|
* xrealloc, xcalloc, and xfree.
|
||||||
|
*
|
||||||
|
* For example, your `prism_xallocator.h` file could look like this:
|
||||||
|
*
|
||||||
* ```
|
* ```
|
||||||
* #ifndef PRISM_XALLOCATOR_H
|
* #ifndef PRISM_XALLOCATOR_H
|
||||||
* #define PRISM_XALLOCATOR_H
|
* #define PRISM_XALLOCATOR_H
|
||||||
@ -140,12 +143,31 @@
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
#ifdef PRISM_XALLOCATOR
|
#ifdef PRISM_XALLOCATOR
|
||||||
# include "prism_xallocator.h"
|
#include "prism_xallocator.h"
|
||||||
#else
|
#else
|
||||||
# define xmalloc malloc
|
/**
|
||||||
# define xrealloc realloc
|
* The malloc function that should be used. This can be overriden with the
|
||||||
# define xcalloc calloc
|
* PRISM_XALLOCATOR define.
|
||||||
# define xfree free
|
*/
|
||||||
|
#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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user