Compare commits
2 Commits
cbd01e7a47
...
1b980b2720
| Author | SHA1 | Date | |
|---|---|---|---|
| 1b980b2720 | |||
| 2c51ab5d78 |
@@ -13,6 +13,8 @@ extern "C" {
|
||||
Design goal: easy to use in tools, easy to test, portable across Linux/macOS.
|
||||
*/
|
||||
|
||||
//#define ENABLE_NICKEL_ALLOC_SHIM
|
||||
|
||||
typedef struct ni_alloc_stats {
|
||||
/* current usage */
|
||||
size_t bytes_in_use; /* user-visible allocated bytes (approx if desired) */
|
||||
@@ -115,6 +117,17 @@ size_t ni_align_up(size_t x, size_t align);
|
||||
*/
|
||||
bool ni_alloc_validate(void);
|
||||
|
||||
|
||||
#ifdef ENABLE_NICKEL_ALLOC_SHIM
|
||||
/* Allocation functions using the global allocator.
|
||||
define symbols pointing at our versions
|
||||
*/
|
||||
void* malloc(size_t size) { ni_malloc(size); }
|
||||
void free(void* ptr) { ni_free(ptr); }
|
||||
void* realloc(void* ptr, size_t new_size) { ni_realloc(ptr, new_size); }
|
||||
void* calloc(size_t count, size_t elem_size) { ni_calloc(count, elem_size); }
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user