shithub: femtolisp

ref: 10d16c10bed72a177a99e0a9a3f3caca6c38ce94
dir: /mem.h/

View raw version
#if defined(MEM_NEED_ALIGNED)
void *fl_malloc(size_t sz);
void *fl_calloc(size_t n, size_t esz);
void *fl_realloc(void *p0, size_t sz);
void fl_free(void *p0);
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