From a1256ac8e4378ab58507e70519be73d4fc4da601 Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Sun, 27 Nov 2022 16:08:15 +0800 Subject: [PATCH] more code --- source/common/src/tdataformat.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index b40e48eb96..a39c5a5b42 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -493,12 +493,9 @@ void tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) { void tRowDestroy(SRow *pRow) { tFree((uint8_t *)pRow); } static int32_t tRowPCmprFn(const void *p1, const void *p2) { - SRow *pRow1 = *(SRow **)p1; - SRow *pRow2 = *(SRow **)p2; - - if (pRow1->ts < pRow2->ts) { + if ((*(SRow **)p1)->ts < (*(SRow **)p2)->ts) { return -1; - } else if (pRow1->ts > pRow2->ts) { + } else if ((*(SRow **)p1)->ts > (*(SRow **)p2)->ts) { return 1; } @@ -566,10 +563,10 @@ _exit: return code; } int32_t tRowMergeSort(SArray *aRowP, STSchema *pTSchema, int8_t flag) { - int32_t code = 0; - if (aRowP->size <= 1) return 0; + int32_t code = 0; + taosArraySort(aRowP, tRowPCmprFn); int32_t iStart = 0;