fix(query): fix error in windows and darwin system.

This commit is contained in:
Haojun Liao 2022-11-25 22:54:54 +08:00
parent 7fe4cf7bbe
commit d77f5fa70c
4 changed files with 9 additions and 8 deletions

View File

@ -43,6 +43,7 @@ extern "C" {
#include <sys/utsname.h> #include <sys/utsname.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <termios.h> #include <termios.h>
#include <cpuid.h>
#if defined(DARWIN) #if defined(DARWIN)
#else #else
@ -81,7 +82,6 @@ extern "C" {
#include <string.h> #include <string.h>
#include <wchar.h> #include <wchar.h>
#include <wctype.h> #include <wctype.h>
#include <cpuid.h>
#if __AVX__ #if __AVX__
#include <immintrin.h> #include <immintrin.h>

View File

@ -24,12 +24,9 @@
extern "C" { extern "C" {
#endif #endif
typedef struct SArray* SIDList;
typedef struct SPageInfo SPageInfo; typedef struct SPageInfo SPageInfo;
typedef struct SDiskbasedBuf SDiskbasedBuf; typedef struct SDiskbasedBuf SDiskbasedBuf;
#define DEFAULT_INTERN_BUF_PAGE_SIZE (1024LL) // in bytes
typedef struct SFilePage { typedef struct SFilePage {
int32_t num; int32_t num;
char data[]; char data[];
@ -69,7 +66,7 @@ void* getNewBufPage(SDiskbasedBuf* pBuf, int32_t* pageId);
* @param pBuf * @param pBuf
* @return * @return
*/ */
SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf); SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf);
/** /**
* get the specified buffer page by id * get the specified buffer page by id
@ -111,7 +108,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf);
* @param pList * @param pList
* @return * @return
*/ */
SPageInfo* getLastPageInfo(SIDList pList); SPageInfo* getLastPageInfo(SArray* pList);
/** /**
* *

View File

@ -350,6 +350,10 @@ void* taosMemoryMallocAlign(uint32_t alignment, int64_t size) {
#ifdef USE_TD_MEMORY #ifdef USE_TD_MEMORY
ASSERT(0); ASSERT(0);
#else #else
#if defined(LINUX)
return memalign(alignment, size); return memalign(alignment, size);
#else
return taosMemoryMalloc(size);
#endif
#endif #endif
} }

View File

@ -495,7 +495,7 @@ void releaseBufPageInfo(SDiskbasedBuf* pBuf, SPageInfo* pi) {
size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; } size_t getTotalBufSize(const SDiskbasedBuf* pBuf) { return (size_t)pBuf->totalBufSize; }
SIDList getDataBufPagesIdList(SDiskbasedBuf* pBuf) { SArray* getDataBufPagesIdList(SDiskbasedBuf* pBuf) {
ASSERT(pBuf != NULL); ASSERT(pBuf != NULL);
return pBuf->pIdList; return pBuf->pIdList;
} }
@ -561,7 +561,7 @@ void destroyDiskbasedBuf(SDiskbasedBuf* pBuf) {
taosMemoryFreeClear(pBuf); taosMemoryFreeClear(pBuf);
} }
SPageInfo* getLastPageInfo(SIDList pList) { SPageInfo* getLastPageInfo(SArray* pList) {
size_t size = taosArrayGetSize(pList); size_t size = taosArrayGetSize(pList);
SPageInfo* pPgInfo = taosArrayGetP(pList, size - 1); SPageInfo* pPgInfo = taosArrayGetP(pList, size - 1);
return pPgInfo; return pPgInfo;