From b6b5c037443421c81f48b107bc12d314633a569f Mon Sep 17 00:00:00 2001 From: Liu Jicong Date: Tue, 10 Aug 2021 20:02:44 +0800 Subject: [PATCH] small fix --- .gitignore | 1 + src/common/src/tdataformat.c | 1 + src/util/src/tfunctional.c | 5 +++-- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 50f4251320..2c37aa92f7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +.ycm_extra_conf.py .vscode/ .idea/ cmake-build-debug/ diff --git a/src/common/src/tdataformat.c b/src/common/src/tdataformat.c index a3a6c0fed4..a5aabbe1f6 100644 --- a/src/common/src/tdataformat.c +++ b/src/common/src/tdataformat.c @@ -517,6 +517,7 @@ void tdAppendMemRowToDataCol(SMemRow row, STSchema *pSchema, SDataCols *pCols, b } } +//TODO: refactor this function to eliminate additional memory copy int tdMergeDataCols(SDataCols *target, SDataCols *source, int rowsToMerge, int *pOffset, bool forceSetNull) { ASSERT(rowsToMerge > 0 && rowsToMerge <= source->numOfRows); ASSERT(target->numOfCols == source->numOfCols); diff --git a/src/util/src/tfunctional.c b/src/util/src/tfunctional.c index c470a2b8ae..8b20f8fc0a 100644 --- a/src/util/src/tfunctional.c +++ b/src/util/src/tfunctional.c @@ -14,23 +14,24 @@ */ #include "tfunctional.h" -#include "tarray.h" - tGenericSavedFunc* genericSavedFuncInit(GenericVaFunc func, int numOfArgs) { tGenericSavedFunc* pSavedFunc = malloc(sizeof(tGenericSavedFunc) + numOfArgs * (sizeof(void*))); + if(pSavedFunc == NULL) return NULL; pSavedFunc->func = func; return pSavedFunc; } tI32SavedFunc* i32SavedFuncInit(I32VaFunc func, int numOfArgs) { tI32SavedFunc* pSavedFunc = malloc(sizeof(tI32SavedFunc) + numOfArgs * sizeof(void *)); + if(pSavedFunc == NULL) return NULL; pSavedFunc->func = func; return pSavedFunc; } tVoidSavedFunc* voidSavedFuncInit(VoidVaFunc func, int numOfArgs) { tVoidSavedFunc* pSavedFunc = malloc(sizeof(tVoidSavedFunc) + numOfArgs * sizeof(void*)); + if(pSavedFunc == NULL) return NULL; pSavedFunc->func = func; return pSavedFunc; } -- GitLab