From 54708073f17a449f978666bf2b655ab0dc05549b Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Thu, 24 Nov 2022 11:49:48 +0800 Subject: [PATCH] more code --- include/common/tdataformat.h | 3 ++- source/common/src/tdataformat.c | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index a0d068de1f..d7a6592ae3 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -84,8 +84,9 @@ int32_t tBufferReserve(SBuffer *pBuffer, int64_t nData, void **ppData); #define COL_VAL_IS_VALUE(CV) ((CV)->flag == CV_FLAG_VALUE) // SRow ================================ -int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer); +int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow); void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal); +void tRowDestroy(SRow *pRow); // SRowIter ================================ int32_t tRowIterOpen(SRow *pRow, STSchema *pTSchema, SRowIter **ppIter); diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 5695341e9c..9b4547f71c 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -95,7 +95,7 @@ typedef struct { } \ } while (0) -int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { +int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SRow **ppRow) { int32_t code = 0; ASSERT(taosArrayGetSize(aColVal) > 0); @@ -196,9 +196,9 @@ int32_t tRowBuild(SArray *aColVal, STSchema *pTSchema, SBuffer *pBuffer) { } // alloc -------------- - SRow *pRow = NULL; - code = tBufferReserve(pBuffer, nRow, (void **)&pRow); + code = tRealloc((uint8_t **)ppRow, nRow); if (code) return code; + SRow *pRow = *ppRow; // build -------------- pColVal = (SColVal *)taosArrayGet(aColVal, 0); @@ -490,6 +490,8 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) { } } +void tRowDestroy(SRow *pRow) { tFree(pRow); } + // SRowIter ======================================== struct SRowIter { SRow *pRow; -- GitLab