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

make TDB can compile

上级 4c43901c
......@@ -72,7 +72,7 @@ i64 tdbOsPRead(tdb_fd_t fd, void *pData, i64 nBytes, i64 offset) {
}
// tdbOsWrite
i64 taosWriteFile(tdb_fd_t fd, const void *pData, i64 nBytes) {
i64 tdbOsWrite(tdb_fd_t fd, const void *pData, i64 nBytes) {
i64 nWrite = 0;
i64 iWrite = 0;
u8 *pBuf = (u8 *)pData;
......
......@@ -21,7 +21,7 @@ extern "C" {
#endif
// TODO: use cmake to control the option
// #define TDB_FOR_TDENGINE
#define TDB_FOR_TDENGINE
// For memory -----------------
#ifdef TDB_FOR_TDENGINE
......@@ -69,7 +69,7 @@ typedef int tdb_fd_t;
i64 tdbOsRead(tdb_fd_t fd, void *pData, i64 nBytes);
i64 tdbOsPRead(tdb_fd_t fd, void *pData, i64 nBytes, i64 offset);
i64 taosWriteFile(tdb_fd_t fd, const void *pData, i64 nBytes);
i64 tdbOsWrite(tdb_fd_t fd, const void *pData, i64 nBytes);
#define tdbOsFSync fsync
#define tdbOsLSeek lseek
......
......@@ -11,7 +11,7 @@ typedef struct SPoolMem {
} SPoolMem;
static SPoolMem *openPool() {
SPoolMem *pPool = (SPoolMem *)malloc(sizeof(*pPool));
SPoolMem *pPool = (SPoolMem *)tdbOsMalloc(sizeof(*pPool));
pPool->prev = pPool->next = pPool;
pPool->size = 0;
......@@ -31,12 +31,12 @@ static void closePool(SPoolMem *pPool) {
pMem->prev->next = pMem->next;
pPool->size -= pMem->size;
free(pMem);
tdbOsFree(pMem);
} while (1);
assert(pPool->size == 0);
free(pPool);
tdbOsFree(pPool);
}
#define clearPool closePool
......@@ -46,7 +46,7 @@ static void *poolMalloc(void *arg, int size) {
SPoolMem *pPool = (SPoolMem *)arg;
SPoolMem *pMem;
pMem = (SPoolMem *)malloc(sizeof(*pMem) + size);
pMem = (SPoolMem *)tdbOsMalloc(sizeof(*pMem) + size);
if (pMem == NULL) {
assert(0);
}
......@@ -73,7 +73,7 @@ static void poolFree(void *arg, void *ptr) {
pMem->prev->next = pMem->next;
pPool->size -= pMem->size;
free(pMem);
tdbOsFree(pMem);
}
static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册