shithub: femtolisp

ref: d5ae75e18d3fd374910432809f062d5cfea5eb21
dir: /mem.h/

View raw version
#if defined(USE_DLMALLOC)
void *fl_malloc(size_t);
void fl_free(void *);
void *fl_calloc(size_t, size_t);
void *fl_realloc(void *, size_t);
char *fl_strdup(const char *s);
#define MEM_CALLOC(n, sz) fl_calloc((size_t)(n), (size_t)(sz))
#define MEM_ALLOC(n) fl_malloc((size_t)(n))
#define MEM_REALLOC(p, n) fl_realloc((p), (size_t)(n))
#define MEM_FREE(x) fl_free(x)
#define MEM_STRDUP(s) fl_strdup(s)
#else
#define MEM_CALLOC(n, sz) calloc((size_t)(n), (size_t)(sz))
#define MEM_ALLOC(n) malloc((size_t)(n))
#define MEM_REALLOC(p, n) realloc((p), (size_t)(n))
#define MEM_FREE(x) free(x)
#define MEM_STRDUP(s) strdup(s)
#endif