diff --git a/source/libs/tdb/src/db/tdbOs.c b/source/libs/tdb/src/db/tdbOs.c index e52f788da92176697745d73201796668f82799ed..5ca3578985e96715cd6facbc88499282b802eefa 100644 --- a/source/libs/tdb/src/db/tdbOs.c +++ b/source/libs/tdb/src/db/tdbOs.c @@ -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; diff --git a/source/libs/tdb/src/inc/tdbOs.h b/source/libs/tdb/src/inc/tdbOs.h index b8ae85ea6584f7fdb89c19f210d39418644e4768..751c105913c66a311ea8b46c753c0561ee523c64 100644 --- a/source/libs/tdb/src/inc/tdbOs.h +++ b/source/libs/tdb/src/inc/tdbOs.h @@ -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 diff --git a/source/libs/tdb/test/tdbTest.cpp b/source/libs/tdb/test/tdbTest.cpp index 6889e33902907b2437138d9ac6a657b01242c606..e8c6477de05f7dd89fdbb56334301fce67593ac7 100644 --- a/source/libs/tdb/test/tdbTest.cpp +++ b/source/libs/tdb/test/tdbTest.cpp @@ -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) {