From d77f5fa70c001a5c756edb3cec91441fec57fb53 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 25 Nov 2022 22:54:54 +0800 Subject: [PATCH] fix(query): fix error in windows and darwin system. --- include/os/os.h | 2 +- include/util/tpagedbuf.h | 7 ++----- source/os/src/osMemory.c | 4 ++++ source/util/src/tpagedbuf.c | 4 ++-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/include/os/os.h b/include/os/os.h index 0334cd4d95..ab4d0a406e 100644 --- a/include/os/os.h +++ b/include/os/os.h @@ -43,6 +43,7 @@ extern "C" { #include #include #include +#include #if defined(DARWIN) #else @@ -81,7 +82,6 @@ extern "C" { #include #include #include -#include #if __AVX__ #include diff --git a/include/util/tpagedbuf.h b/include/util/tpagedbuf.h index 5f81ccfcfd..73af65997d 100644 --- a/include/util/tpagedbuf.h +++ b/include/util/tpagedbuf.h @@ -24,12 +24,9 @@ extern "C" { #endif -typedef struct SArray* SIDList; typedef struct SPageInfo SPageInfo; typedef struct SDiskbasedBuf SDiskbasedBuf; -#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024LL) // in bytes - typedef struct SFilePage { int32_t num; char data[]; @@ -69,7 +66,7 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId); * @param pBuf * @return */ -SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf); +SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf); /** * get the specified buffer page by id @@ -111,7 +108,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf); * @param pList * @return */ -SPageInfo* getLastPageInfo(SIDList pList); +SPageInfo* getLastPageInfo(SArray* pList); /** * diff --git a/source/os/src/osMemory.c b/source/os/src/osMemory.c index 1facff1f3b..2f30e8977a 100644 --- a/source/os/src/osMemory.c +++ b/source/os/src/osMemory.c @@ -350,6 +350,10 @@ void* taosMemoryMallocAlign(uint32_t alignment, int64_t size) { #ifdef USE_TD_MEMORY ASSERT(0); #else +#if defined(LINUX) return memalign(alignment, size); +#else + return taosMemoryMalloc(size); +#endif #endif } diff --git a/source/util/src/tpagedbuf.c b/source/util/src/tpagedbuf.c index 79ea10552c..e1a43ace47 100644 --- a/source/util/src/tpagedbuf.c +++ b/source/util/src/tpagedbuf.c @@ -495,7 +495,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) { size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; } -SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf) { +SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) { ASSERT(pBuf != NULL); return pBuf->pIdList; } @@ -561,7 +561,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) { taosMemoryFreeClear(pBuf); } -SPageInfo* getLastPageInfo(SIDList pList) { +SPageInfo* getLastPageInfo(SArray* pList) { size_t size = taosArrayGetSize(pList); SPageInfo* pPgInfo = taosArrayGetP(pList, size - 1); return pPgInfo;