提交 eec3543c 编写于 作者: H Hongze Cheng

refact

上级 773db063
......@@ -35,10 +35,14 @@ typedef struct {
SMemAllocatorIf interface;
} SMemAllocator;
#define amalloc(allocator, size) (*((allocator)->interface.malloc))((allocator)->impl, size)
#define acalloc(allocator, nmemb, size) (*((allocator)->interface.calloc))((allocator)->impl, nmemb, size)
#define arealloc(allocator, ptr, size) (*((allocator)->interface.realloc))((allocator)->impl, ptr, size)
#define afree(allocator, ptr, size) (*((allocator)->interface.free))((allocator)->impl, ptr, size)
#define amalloc(allocator, size) \
((allocator) ? (*((allocator)->interface.malloc))((allocator)->impl, (size)) : malloc(size))
#define acalloc(allocator, nmemb, size) \
((allocator) ? (*((allocator)->interface.calloc))((allocator)->impl, (nmemb), (size)) : calloc((nmemb), (size)))
#define arealloc(allocator, ptr, size) \
((allocator) ? (*((allocator)->interface.realloc))((allocator)->impl, (ptr), (size)) : realloc((ptr), (size)))
#define afree(allocator, ptr, size) \
((allocator) ? (*((allocator)->interface.free))((allocator)->impl, (ptr), (size)) : free(ptr))
#ifdef __cplusplus
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册