提交 9d957275 编写于 作者: H Hongze Cheng

more TDB

上级 7e586f4d
......@@ -16,12 +16,36 @@
#include "tdbInt.h"
int tdbPageCreate(int pageSize, SPage **ppPage, void *(*xMalloc)(void *, size_t), void *arg) {
// TODO
SPage *pPage;
u8 *ptr;
int size;
*ppPage = NULL;
size = pageSize + sizeof(*pPage);
ptr = (u8 *)((*xMalloc)(arg, size));
if (pPage == NULL) {
return -1;
}
memset(ptr, 0, size);
pPage = (SPage *)(ptr + pageSize);
pPage->pData = ptr;
pPage->pageSize = pageSize;
/* TODO */
*ppPage = pPage;
return 0;
}
int tdbPageDestroy(SPage *pPage, void (*xFree)(void *)) {
// TODO
u8 *ptr;
ptr = pPage->pData;
(*xFree)(ptr);
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册