This commit is contained in:
Hongze Cheng 2023-09-26 11:08:20 +08:00
parent 03456ce443
commit 9e8d761813
1 changed files with 6 additions and 1 deletions

View File

@ -165,7 +165,12 @@ static FORCE_INLINE int32_t tarray2SortInsert(void *arr, const void *elePtr, int
#define TARRAY2_FOREACH_PTR_REVERSE(a, ep) \ #define TARRAY2_FOREACH_PTR_REVERSE(a, ep) \
for (int32_t __i = (a)->size - 1; __i >= 0 && ((ep) = &(a)->data[__i], 1); __i--) for (int32_t __i = (a)->size - 1; __i >= 0 && ((ep) = &(a)->data[__i], 1); __i--)
#define TARRAY2_SORT(a, cmp) taosSort((a)->data, (a)->size, sizeof((a)->data[0]), (__compar_fn_t)cmp) #define TARRAY2_SORT(a, cmp) \
do { \
if ((a)->size > 1) { \
taosSort((a)->data, (a)->size, sizeof((a)->data[0]), (__compar_fn_t)cmp); \
} \
} while (0)
#ifdef __cplusplus #ifdef __cplusplus
} }