Skip to content

Commit ee1a4ac

Browse files
committed
Document xallocator functions
1 parent 0873343 commit ee1a4ac

File tree

1 file changed

+30
-8
lines changed

1 file changed

+30
-8
lines changed

include/prism/defines.h

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,12 @@
126126
#endif
127127

128128
/**
129-
* If you build prism with a custom allocator, configure it with "-D PRISM_XALLOCATOR"
130-
* to use your own allocator that defines xmalloc, xrealloc, xcalloc, and xfree.
131-
* For example, your `custom_allocator.h` file could look like this:
129+
* If you build prism with a custom allocator, configure it with
130+
* "-D PRISM_XALLOCATOR" to use your own allocator that defines xmalloc,
131+
* xrealloc, xcalloc, and xfree.
132+
*
133+
* For example, your `prism_xallocator.h` file could look like this:
134+
*
132135
* ```
133136
* #ifndef PRISM_XALLOCATOR_H
134137
* #define PRISM_XALLOCATOR_H
@@ -140,12 +143,31 @@
140143
* ```
141144
*/
142145
#ifdef PRISM_XALLOCATOR
143-
# include "prism_xallocator.h"
146+
#include "prism_xallocator.h"
144147
#else
145-
# define xmalloc malloc
146-
# define xrealloc realloc
147-
# define xcalloc calloc
148-
# define xfree free
148+
/**
149+
* The malloc function that should be used. This can be overriden with the
150+
* PRISM_XALLOCATOR define.
151+
*/
152+
#define xmalloc malloc
153+
154+
/**
155+
* The realloc function that should be used. This can be overriden with the
156+
* PRISM_XALLOCATOR define.
157+
*/
158+
#define xrealloc realloc
159+
160+
/**
161+
* The calloc function that should be used. This can be overriden with the
162+
* PRISM_XALLOCATOR define.
163+
*/
164+
#define xcalloc calloc
165+
166+
/**
167+
* The free function that should be used. This can be overriden with the
168+
* PRISM_XALLOCATOR define.
169+
*/
170+
#define xfree free
149171
#endif
150172

151173
#endif

0 commit comments

Comments
 (0)