make TDB can compile

This commit is contained in:
Hongze Cheng 2022-03-28 05:44:03 +00:00
parent 4c43901c44
commit b23d2c7b6e
3 changed files with 8 additions and 8 deletions

View File

@ -72,7 +72,7 @@ i64 tdbOsPRead(tdb_fd_t fd, void *pData, i64 nBytes, i64 offset) {
} }
// tdbOsWrite // 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 nWrite = 0;
i64 iWrite = 0; i64 iWrite = 0;
u8 *pBuf = (u8 *)pData; u8 *pBuf = (u8 *)pData;

View File

@ -21,7 +21,7 @@ extern "C" {
#endif #endif
// TODO: use cmake to control the option // TODO: use cmake to control the option
// #define TDB_FOR_TDENGINE #define TDB_FOR_TDENGINE
// For memory ----------------- // For memory -----------------
#ifdef TDB_FOR_TDENGINE #ifdef TDB_FOR_TDENGINE
@ -69,7 +69,7 @@ typedef int tdb_fd_t;
i64 tdbOsRead(tdb_fd_t fd, void *pData, i64 nBytes); i64 tdbOsRead(tdb_fd_t fd, void *pData, i64 nBytes);
i64 tdbOsPRead(tdb_fd_t fd, void *pData, i64 nBytes, i64 offset); 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 tdbOsFSync fsync
#define tdbOsLSeek lseek #define tdbOsLSeek lseek

View File

@ -11,7 +11,7 @@ typedef struct SPoolMem {
} SPoolMem; } SPoolMem;
static SPoolMem *openPool() { static SPoolMem *openPool() {
SPoolMem *pPool = (SPoolMem *)malloc(sizeof(*pPool)); SPoolMem *pPool = (SPoolMem *)tdbOsMalloc(sizeof(*pPool));
pPool->prev = pPool->next = pPool; pPool->prev = pPool->next = pPool;
pPool->size = 0; pPool->size = 0;
@ -31,12 +31,12 @@ static void closePool(SPoolMem *pPool) {
pMem->prev->next = pMem->next; pMem->prev->next = pMem->next;
pPool->size -= pMem->size; pPool->size -= pMem->size;
free(pMem); tdbOsFree(pMem);
} while (1); } while (1);
assert(pPool->size == 0); assert(pPool->size == 0);
free(pPool); tdbOsFree(pPool);
} }
#define clearPool closePool #define clearPool closePool
@ -46,7 +46,7 @@ static void *poolMalloc(void *arg, int size) {
SPoolMem *pPool = (SPoolMem *)arg; SPoolMem *pPool = (SPoolMem *)arg;
SPoolMem *pMem; SPoolMem *pMem;
pMem = (SPoolMem *)malloc(sizeof(*pMem) + size); pMem = (SPoolMem *)tdbOsMalloc(sizeof(*pMem) + size);
if (pMem == NULL) { if (pMem == NULL) {
assert(0); assert(0);
} }
@ -73,7 +73,7 @@ static void poolFree(void *arg, void *ptr) {
pMem->prev->next = pMem->next; pMem->prev->next = pMem->next;
pPool->size -= pMem->size; pPool->size -= pMem->size;
free(pMem); tdbOsFree(pMem);
} }
static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) { static int tKeyCmpr(const void *pKey1, int kLen1, const void *pKey2, int kLen2) {