diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index e0aacbfec9db8804b4003417689f404b78549afb..b5971d8a9e0c3318aadc4c0f697965c1e25b28d5 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -146,9 +146,9 @@ extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind); void tColDataSortMerge(SArray *colDataArr); -//for raw block -int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, - int32_t nRows, char* lengthOrbitmap, char *data); +// for raw block +int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap, + char *data); // for encode/decode int32_t tPutColData(uint8_t *pBuf, SColData *pColData); int32_t tGetColData(uint8_t *pBuf, SColData *pColData); @@ -261,7 +261,13 @@ struct STag { // STSchema ================================ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version); -void tDestroyTSchema(STSchema *pTSchema); +#define tDestroyTSchema(pTSchema) \ + do { \ + if (pTSchema) { \ + taosMemoryFree(pTSchema); \ + pTSchema = NULL; \ + } \ + } while (0) #endif diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index 5e001a96872306d9369d388f8823a2baecdbf04f..7b3038280acfab0313f61bdb407fbda0a6751c27 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -1532,10 +1532,6 @@ STSchema *tBuildTSchema(SSchema *aSchema, int32_t numOfCols, int32_t version) { return pTSchema; } -void tDestroyTSchema(STSchema *pTSchema) { - if (pTSchema) taosMemoryFree(pTSchema); -} - // SColData ======================================== void tColDataDestroy(void *ph) { SColData *pColData = (SColData *)ph;