33 #ifndef AKMALLOC_MALLOC_H
34 #define AKMALLOC_MALLOC_H
39 #if !defined(AKMALLOC_USE_PREFIX) || !AKMALLOC_USE_PREFIX
40 # define ak_malloc malloc
41 # define ak_calloc calloc
43 # define ak_aligned_alloc aligned_alloc
44 # define ak_posix_memalign posix_memalign
45 # define ak_memalign memalign
46 # define ak_realloc realloc
47 # define ak_malloc_usable_size malloc_usable_size
48 # define ak_malloc_for_each_segment malloc_for_each_segment
51 #if !defined(AKMALLOC_EXPORT)
52 # define AKMALLOC_EXPORT extern
63 #define AK_SEG_CBK_DEFINED
65 #if defined(__cplusplus)
66 # define AK_EXTERN_C_BEGIN extern "C" {
67 # define AK_EXTERN_C_END }
69 # define AK_EXTERN_C_BEGIN
70 # define AK_EXTERN_C_END
81 AKMALLOC_EXPORT
void*
ak_malloc(
size_t n);
90 AKMALLOC_EXPORT
void*
ak_calloc(
size_t n,
size_t s);
96 AKMALLOC_EXPORT
void ak_free(
void* p);
117 AKMALLOC_EXPORT
void*
ak_realloc(
void* p,
size_t newsz);
127 AKMALLOC_EXPORT
void*
ak_memalign(
size_t aln,
size_t sz);
160 #if defined(AKMALLOC_INCLUDE_ONLY)
void ak_malloc_for_each_segment(ak_seg_cbk cbk)
int ak_posix_memalign(void **pptr, size_t aln, size_t sz)
int(* ak_seg_cbk)(const void *p, size_t sz)
void * ak_malloc(size_t n)
void * ak_aligned_alloc(size_t aln, size_t sz)
void * ak_realloc(void *p, size_t newsz)
void * ak_memalign(size_t aln, size_t sz)
void * ak_calloc(size_t n, size_t s)
size_t ak_malloc_usable_size(const void *p)