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

refact

上级 26a3ff9b
...@@ -22,17 +22,14 @@ ...@@ -22,17 +22,14 @@
extern "C" { extern "C" {
#endif #endif
typedef struct SVArenaNode SVArenaNode; typedef struct SVArenaNode {
typedef struct SVMemAllocator SVMemAllocator;
struct SVArenaNode {
TD_SLIST_NODE(SVArenaNode); TD_SLIST_NODE(SVArenaNode);
uint64_t size; // current node size uint64_t size; // current node size
void * ptr; void * ptr;
char data[]; char data[];
}; } SVArenaNode;
struct SVMemAllocator { typedef struct SVMemAllocator {
T_REF_DECLARE() T_REF_DECLARE()
TD_DLIST_NODE(SVMemAllocator); TD_DLIST_NODE(SVMemAllocator);
uint64_t capacity; uint64_t capacity;
...@@ -40,7 +37,7 @@ struct SVMemAllocator { ...@@ -40,7 +37,7 @@ struct SVMemAllocator {
uint64_t lsize; uint64_t lsize;
SVArenaNode *pNode; SVArenaNode *pNode;
TD_SLIST(SVArenaNode) nlist; TD_SLIST(SVArenaNode) nlist;
}; } SVMemAllocator;
SVMemAllocator *vmaCreate(uint64_t capacity, uint64_t ssize, uint64_t lsize); SVMemAllocator *vmaCreate(uint64_t capacity, uint64_t ssize, uint64_t lsize);
void vmaDestroy(SVMemAllocator *pVMA); void vmaDestroy(SVMemAllocator *pVMA);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册