提交 22d59537 编写于 作者: wmmhello's avatar wmmhello

change taosArrayDestroy(*)->taosArrayDestroy(**)

上级 0e0a4c09
...@@ -517,8 +517,8 @@ static int32_t applySchemaAction(TAOS* taos, SSchemaAction* action, SSmlLinesInf ...@@ -517,8 +517,8 @@ static int32_t applySchemaAction(TAOS* taos, SSchemaAction* action, SSmlLinesInf
static int32_t destroySmlSTableSchema(SSmlSTableSchema* schema) { static int32_t destroySmlSTableSchema(SSmlSTableSchema* schema) {
taosHashCleanup(schema->tagHash); taosHashCleanup(schema->tagHash);
taosHashCleanup(schema->fieldHash); taosHashCleanup(schema->fieldHash);
taosArrayDestroy(schema->tags); taosArrayDestroy(&schema->tags);
taosArrayDestroy(schema->fields); taosArrayDestroy(&schema->fields);
return 0; return 0;
} }
...@@ -969,13 +969,13 @@ static int32_t applyChildTableDataPointsWithStmt(TAOS* taos, char* cTableName, c ...@@ -969,13 +969,13 @@ static int32_t applyChildTableDataPointsWithStmt(TAOS* taos, char* cTableName, c
} }
free(colBinds); free(colBinds);
} }
taosArrayDestroy(rowsBind); taosArrayDestroy(&rowsBind);
//free tag bind //free tag bind
for (int i = 0; i < taosArrayGetSize(tagBinds); ++i) { for (int i = 0; i < taosArrayGetSize(tagBinds); ++i) {
TAOS_BIND* bind = taosArrayGet(tagBinds, i); TAOS_BIND* bind = taosArrayGet(tagBinds, i);
free(bind->length); free(bind->length);
} }
taosArrayDestroy(tagBinds); taosArrayDestroy(&tagBinds);
return code; return code;
} }
...@@ -1036,7 +1036,7 @@ static int32_t insertChildTablePointsBatch(TAOS* taos, char* cTableName, char* s ...@@ -1036,7 +1036,7 @@ static int32_t insertChildTablePointsBatch(TAOS* taos, char* cTableName, char* s
tscDebug("SML:0x%"PRIx64" insert child table batch from line %d to line %d.", info->id, i, j - 1); tscDebug("SML:0x%"PRIx64" insert child table batch from line %d to line %d.", info->id, i, j - 1);
code = doInsertChildTablePoints(taos, sql, cTableName, tagsBind, batchBind, info); code = doInsertChildTablePoints(taos, sql, cTableName, tagsBind, batchBind, info);
if (code != 0) { if (code != 0) {
taosArrayDestroy(batchBind); taosArrayDestroy(&batchBind);
tfree(sql); tfree(sql);
return code; return code;
} }
...@@ -1044,7 +1044,7 @@ static int32_t insertChildTablePointsBatch(TAOS* taos, char* cTableName, char* s ...@@ -1044,7 +1044,7 @@ static int32_t insertChildTablePointsBatch(TAOS* taos, char* cTableName, char* s
} }
i = j; i = j;
} }
taosArrayDestroy(batchBind); taosArrayDestroy(&batchBind);
tfree(sql); tfree(sql);
return code; return code;
...@@ -1196,7 +1196,7 @@ cleanup: ...@@ -1196,7 +1196,7 @@ cleanup:
pCTablePoints = taosHashIterate(cname2points, NULL); pCTablePoints = taosHashIterate(cname2points, NULL);
while (pCTablePoints) { while (pCTablePoints) {
SArray* pPoints = *pCTablePoints; SArray* pPoints = *pCTablePoints;
taosArrayDestroy(pPoints); taosArrayDestroy(&pPoints);
pCTablePoints = taosHashIterate(cname2points, pCTablePoints); pCTablePoints = taosHashIterate(cname2points, pCTablePoints);
} }
taosHashCleanup(cname2points); taosHashCleanup(cname2points);
......
...@@ -472,7 +472,7 @@ cleanup: ...@@ -472,7 +472,7 @@ cleanup:
destroySmlDataPoint(points+i); destroySmlDataPoint(points+i);
} }
taosArrayDestroy(lpPoints); taosArrayDestroy(&lpPoints);
tfree(info); tfree(info);
return code; return code;
......
...@@ -1175,8 +1175,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) { ...@@ -1175,8 +1175,8 @@ int tscBuildQueryMsg(SSqlObj *pSql, SSqlInfo *pInfo) {
_end: _end:
freeQueryAttr(&query); freeQueryAttr(&query);
taosArrayDestroy(tableScanOperator); taosArrayDestroy(&tableScanOperator);
taosArrayDestroy(queryOperator); taosArrayDestroy(&queryOperator);
return code; return code;
} }
...@@ -2259,7 +2259,7 @@ int tscProcessRetrieveFuncRsp(SSqlObj* pSql) { ...@@ -2259,7 +2259,7 @@ int tscProcessRetrieveFuncRsp(SSqlObj* pSql) {
SQueryInfo* parQueryInfo = tscGetQueryInfo(&parent->cmd); SQueryInfo* parQueryInfo = tscGetQueryInfo(&parent->cmd);
assert(parent->signature == parent && (int64_t)pSql->param == parent->self); assert(parent->signature == parent && (int64_t)pSql->param == parent->self);
taosArrayDestroy(parQueryInfo->pUdfInfo); taosArrayDestroy(&parQueryInfo->pUdfInfo);
parQueryInfo->pUdfInfo = pQueryInfo->pUdfInfo; // assigned to parent sql obj. parQueryInfo->pUdfInfo = pQueryInfo->pUdfInfo; // assigned to parent sql obj.
pQueryInfo->pUdfInfo = NULL; pQueryInfo->pUdfInfo = NULL;
...@@ -2371,7 +2371,7 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) { ...@@ -2371,7 +2371,7 @@ int tscProcessMultiTableMetaRsp(SSqlObj *pSql) {
int32_t size = 0; int32_t size = 0;
if (p->vgroupIdList!= NULL) { if (p->vgroupIdList!= NULL) {
taosArrayDestroy(p->vgroupIdList); taosArrayDestroy(&p->vgroupIdList);
} }
p->vgroupIdList = createVgroupIdListFromMsg(pParentSql, pMsg, pSet, fname, &size, pSql->self); p->vgroupIdList = createVgroupIdListFromMsg(pParentSql, pMsg, pSet, fname, &size, pSql->self);
...@@ -3116,8 +3116,8 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) { ...@@ -3116,8 +3116,8 @@ int tscRenewTableMeta(SSqlObj *pSql, int32_t tableIndex) {
char* n = strdup(name); char* n = strdup(name);
taosArrayPush(pNameList, &n); taosArrayPush(pNameList, &n);
code = getMultiTableMetaFromMnode(tmpSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true); code = getMultiTableMetaFromMnode(tmpSql, pNameList, vgroupList, NULL, tscTableMetaCallBack, true);
taosArrayDestroyEx(pNameList, freeElem); taosArrayDestroyEx(&pNameList, freeElem);
taosArrayDestroyEx(vgroupList, freeElem); taosArrayDestroyEx(&vgroupList, freeElem);
return code; return code;
} }
......
...@@ -194,7 +194,7 @@ fail: ...@@ -194,7 +194,7 @@ fail:
} }
if (pSub != NULL) { if (pSub != NULL) {
taosArrayDestroy(pSub->progress); taosArrayDestroy(&pSub->progress);
tsem_destroy(&pSub->sem); tsem_destroy(&pSub->sem);
free(pSub); free(pSub);
pSub = NULL; pSub = NULL;
...@@ -300,7 +300,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { ...@@ -300,7 +300,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
} }
taosArraySort(progress, tscCompareSubscriptionProgress); taosArraySort(progress, tscCompareSubscriptionProgress);
taosArrayDestroy(pSub->progress); taosArrayDestroy(&pSub->progress);
pSub->progress = progress; pSub->progress = progress;
if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) { if (UTIL_TABLE_IS_SUPER_TABLE(pTableMetaInfo)) {
...@@ -308,7 +308,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) { ...@@ -308,7 +308,7 @@ static int tscUpdateSubscription(STscObj* pObj, SSub* pSub) {
tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables); tscFreeVgroupTableInfo(pTableMetaInfo->pVgroupTables);
tscBuildVgroupTableInfo(pSql, pTableMetaInfo, tables); tscBuildVgroupTableInfo(pSql, pTableMetaInfo, tables);
} }
taosArrayDestroy(tables); taosArrayDestroy(&tables);
if (pTableMetaInfo->pVgroupTables && taosArrayGetSize(pTableMetaInfo->pVgroupTables) > 0) { if (pTableMetaInfo->pVgroupTables && taosArrayGetSize(pTableMetaInfo->pVgroupTables) > 0) {
TSDB_QUERY_SET_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY); TSDB_QUERY_SET_TYPE(tscGetQueryInfo(pCmd)->type, TSDB_QUERY_TYPE_MULTITABLE_QUERY);
...@@ -626,7 +626,7 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) { ...@@ -626,7 +626,7 @@ void taos_unsubscribe(TAOS_SUB *tsub, int keepProgress) {
} }
} }
taosArrayDestroy(pSub->progress); taosArrayDestroy(&pSub->progress);
tsem_destroy(&pSub->sem); tsem_destroy(&pSub->sem);
memset(pSub, 0, sizeof(*pSub)); memset(pSub, 0, sizeof(*pSub));
free(pSub); free(pSub);
......
...@@ -431,7 +431,7 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) { ...@@ -431,7 +431,7 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) {
// tscFieldInfoClear(&pSupporter->fieldsInfo); // tscFieldInfoClear(&pSupporter->fieldsInfo);
if (pSupporter->fieldsInfo.internalField != NULL) { if (pSupporter->fieldsInfo.internalField != NULL) {
taosArrayDestroy(pSupporter->fieldsInfo.internalField); taosArrayDestroy(&pSupporter->fieldsInfo.internalField);
} }
if (pSupporter->pTSBuf != NULL) { if (pSupporter->pTSBuf != NULL) {
tsBufDestroy(pSupporter->pTSBuf); tsBufDestroy(pSupporter->pTSBuf);
...@@ -446,7 +446,7 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) { ...@@ -446,7 +446,7 @@ static void tscDestroyJoinSupporter(SJoinSupporter* pSupporter) {
} }
if (pSupporter->pVgroupTables != NULL) { if (pSupporter->pVgroupTables != NULL) {
//taosArrayDestroy(pSupporter->pVgroupTables); //taosArrayDestroy(&pSupporter->pVgroupTables);
tscFreeVgroupTableInfo(pSupporter->pVgroupTables); tscFreeVgroupTableInfo(pSupporter->pVgroupTables);
pSupporter->pVgroupTables = NULL; pSupporter->pVgroupTables = NULL;
} }
...@@ -804,7 +804,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr ...@@ -804,7 +804,7 @@ void tscBuildVgroupTableInfo(SSqlObj* pSql, STableMetaInfo* pTableMetaInfo, SArr
if (taosArrayGetSize(result) <= 0) { if (taosArrayGetSize(result) <= 0) {
pTableMetaInfo->pVgroupTables = NULL; pTableMetaInfo->pVgroupTables = NULL;
taosArrayDestroy(result); taosArrayDestroy(&result);
} else { } else {
pTableMetaInfo->pVgroupTables = result; pTableMetaInfo->pVgroupTables = result;
...@@ -967,7 +967,7 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar ...@@ -967,7 +967,7 @@ static int32_t getIntersectionOfTableTuple(SQueryInfo* pQueryInfo, SSqlObj* pPar
if (!checkForDuplicateTagVal(pColSchema, p, pParentSql)) { if (!checkForDuplicateTagVal(pColSchema, p, pParentSql)) {
for (int32_t j = 0; j <= i; j++) { for (int32_t j = 0; j <= i; j++) {
taosArrayDestroy(ctxlist[j].res); taosArrayDestroy(&ctxlist[j].res);
} }
return TSDB_CODE_QRY_DUP_JOIN_KEY; return TSDB_CODE_QRY_DUP_JOIN_KEY;
} }
...@@ -1269,7 +1269,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow ...@@ -1269,7 +1269,7 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
pParentSql->res.code = code; pParentSql->res.code = code;
tscAsyncResultOnError(pParentSql); tscAsyncResultOnError(pParentSql);
taosArrayDestroy(resList); taosArrayDestroy(&resList);
goto _return; goto _return;
} }
...@@ -1309,11 +1309,11 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow ...@@ -1309,11 +1309,11 @@ static void tidTagRetrieveCallback(void* param, TAOS_RES* tres, int32_t numOfRow
for (int32_t i = 0; i < rsize; ++i) { for (int32_t i = 0; i < rsize; ++i) {
SArray** s = taosArrayGet(resList, i); SArray** s = taosArrayGet(resList, i);
if (*s) { if (*s) {
taosArrayDestroy(*s); taosArrayDestroy(s);
} }
} }
taosArrayDestroy(resList); taosArrayDestroy(&resList);
_return: _return:
taosReleaseRef(tscObjRef, handle); taosReleaseRef(tscObjRef, handle);
...@@ -1993,7 +1993,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter ...@@ -1993,7 +1993,7 @@ int32_t tscCreateJoinSubquery(SSqlObj *pSql, int16_t tableIndex, SJoinSupporter
pNewQueryInfo->limit.limit = -1; pNewQueryInfo->limit.limit = -1;
pNewQueryInfo->limit.offset = 0; pNewQueryInfo->limit.offset = 0;
taosArrayDestroy(pNewQueryInfo->pUpstream); taosArrayDestroy(&pNewQueryInfo->pUpstream);
pNewQueryInfo->order.orderColId = INT32_MIN; pNewQueryInfo->order.orderColId = INT32_MIN;
...@@ -2255,8 +2255,8 @@ void doAppendData(SInterResult* pInterResult, TAOS_ROW row, int32_t numOfCols, S ...@@ -2255,8 +2255,8 @@ void doAppendData(SInterResult* pInterResult, TAOS_ROW row, int32_t numOfCols, S
static void tscFreeFirstRoundSup(void **param) { static void tscFreeFirstRoundSup(void **param) {
if (*param) { if (*param) {
SFirstRoundQuerySup* pSup = (SFirstRoundQuerySup*)*param; SFirstRoundQuerySup* pSup = (SFirstRoundQuerySup*)*param;
taosArrayDestroyEx(pSup->pResult, freeInterResult); taosArrayDestroyEx(&pSup->pResult, freeInterResult);
taosArrayDestroy(pSup->pColsInfo); taosArrayDestroy(&pSup->pColsInfo);
tfree(*param); tfree(*param);
} }
} }
......
...@@ -1540,7 +1540,7 @@ void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeCachedMeta, uint64_t id) { ...@@ -1540,7 +1540,7 @@ void tscFreeQueryInfo(SSqlCmd* pCmd, bool removeCachedMeta, uint64_t id) {
} }
if (pQueryInfo->udfCopy) { if (pQueryInfo->udfCopy) {
pQueryInfo->pUdfInfo = taosArrayDestroy(pQueryInfo->pUdfInfo); pQueryInfo->pUdfInfo = taosArrayDestroy(&pQueryInfo->pUdfInfo);
} else { } else {
pQueryInfo->pUdfInfo = tscDestroyUdfArrayList(pQueryInfo->pUdfInfo); pQueryInfo->pUdfInfo = tscDestroyUdfArrayList(pQueryInfo->pUdfInfo);
} }
...@@ -1602,7 +1602,7 @@ void* tscCleanupTableMetaMap(SHashObj* pTableMetaMap) { ...@@ -1602,7 +1602,7 @@ void* tscCleanupTableMetaMap(SHashObj* pTableMetaMap) {
STableMetaVgroupInfo* p = taosHashIterate(pTableMetaMap, NULL); STableMetaVgroupInfo* p = taosHashIterate(pTableMetaMap, NULL);
while (p) { while (p) {
taosArrayDestroy(p->vgroupIdList); taosArrayDestroy(&p->vgroupIdList);
tfree(p->pTableMeta); tfree(p->pTableMeta);
p = taosHashIterate(pTableMetaMap, p); p = taosHashIterate(pTableMetaMap, p);
} }
...@@ -1795,7 +1795,7 @@ void* tscDestroyBlockArrayList(SSqlObj *pSql, SArray* pDataBlockList) { ...@@ -1795,7 +1795,7 @@ void* tscDestroyBlockArrayList(SSqlObj *pSql, SArray* pDataBlockList) {
tscDestroyDataBlock(pSql, d, false); tscDestroyDataBlock(pSql, d, false);
} }
taosArrayDestroy(pDataBlockList); taosArrayDestroy(&pDataBlockList);
return NULL; return NULL;
} }
...@@ -1834,7 +1834,7 @@ void* tscDestroyUdfArrayList(SArray* pUdfList) { ...@@ -1834,7 +1834,7 @@ void* tscDestroyUdfArrayList(SArray* pUdfList) {
freeUdfInfo(udf); freeUdfInfo(udf);
} }
taosArrayDestroy(pUdfList); taosArrayDestroy(&pUdfList);
return NULL; return NULL;
} }
...@@ -2470,7 +2470,7 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) { ...@@ -2470,7 +2470,7 @@ void tscFieldInfoClear(SFieldInfo* pFieldInfo) {
} }
} }
taosArrayDestroy(pFieldInfo->internalField); taosArrayDestroy(&pFieldInfo->internalField);
tfree(pFieldInfo->final); tfree(pFieldInfo->final);
memset(pFieldInfo, 0, sizeof(SFieldInfo)); memset(pFieldInfo, 0, sizeof(SFieldInfo));
......
...@@ -894,6 +894,6 @@ SMemRow mergeTwoMemRows(void *buffer, SMemRow row1, SMemRow row2, STSchema *pSch ...@@ -894,6 +894,6 @@ SMemRow mergeTwoMemRows(void *buffer, SMemRow row1, SMemRow row2, STSchema *pSch
} }
ASSERT(kvLen == memRowTLen(tRow)); ASSERT(kvLen == memRowTLen(tRow));
} }
taosArrayDestroy(stashRow); taosArrayDestroy(&stashRow);
return buffer; return buffer;
} }
...@@ -222,11 +222,9 @@ void tVariantDestroy(tVariant *pVar) { ...@@ -222,11 +222,9 @@ void tVariantDestroy(tVariant *pVar) {
void* p = taosArrayGetP(pVar->arr, i); void* p = taosArrayGetP(pVar->arr, i);
free(p); free(p);
} }
taosArrayDestroy(pVar->arr); taosArrayDestroy(&pVar->arr);
pVar->arr = NULL;
} else if (pVar->nType == TSDB_DATA_TYPE_VALUE_ARRAY) { } else if (pVar->nType == TSDB_DATA_TYPE_VALUE_ARRAY) {
taosArrayDestroy(pVar->arr); taosArrayDestroy(&pVar->arr);
pVar->arr = NULL;
} }
} }
......
Subproject commit 7da3cc9e4ad1030c2eec250b869a8fa215b4a4b4 Subproject commit 41787fd5b8baacabb95e16ecda2b45283dfe85d2
Subproject commit 7eae58a0fbf7c7321dd1bdc96e375d4c832cf373 Subproject commit efd744e73658de83c885377c62d89b7780658c6f
...@@ -3155,7 +3155,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) { ...@@ -3155,7 +3155,7 @@ static int32_t mnodeProcessMultiTableMetaMsg(SMnodeMsg *pMsg) {
_end: _end:
tfree(str); tfree(str);
tfree(nameList); tfree(nameList);
taosArrayDestroy(pList); taosArrayDestroy(&pList);
pMsg->pTable = NULL; pMsg->pTable = NULL;
pMsg->pVgroup = NULL; pMsg->pVgroup = NULL;
tfree(pMultiMeta); tfree(pMultiMeta);
......
Subproject commit 88346a2e4e2e9282d2ec8b8c5264ca1ec23698a1 Subproject commit 07f0d3bb0823e80e05b40cc03fa2e1e6767ef442
...@@ -291,7 +291,7 @@ static int compareRowData(const void *a, const void *b, const void *userData) { ...@@ -291,7 +291,7 @@ static int compareRowData(const void *a, const void *b, const void *userData) {
static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv *pRuntimeEnv, SSDataBlock* pDataBlock, SQLFunctionCtx *pCtx) { static void sortGroupResByOrderList(SGroupResInfo *pGroupResInfo, SQueryRuntimeEnv *pRuntimeEnv, SSDataBlock* pDataBlock, SQLFunctionCtx *pCtx) {
SArray *columnOrderList = getOrderCheckColumns(pRuntimeEnv->pQueryAttr); SArray *columnOrderList = getOrderCheckColumns(pRuntimeEnv->pQueryAttr);
size_t size = taosArrayGetSize(columnOrderList); size_t size = taosArrayGetSize(columnOrderList);
taosArrayDestroy(columnOrderList); taosArrayDestroy(&columnOrderList);
if (size <= 0) { if (size <= 0) {
return; return;
...@@ -368,7 +368,7 @@ void* destroyOutputBuf(SSDataBlock* pBlock) { ...@@ -368,7 +368,7 @@ void* destroyOutputBuf(SSDataBlock* pBlock) {
tfree(pColInfoData->pData); tfree(pColInfoData->pData);
} }
taosArrayDestroy(pBlock->pDataBlock); taosArrayDestroy(&pBlock->pDataBlock);
tfree(pBlock->pBlockStatis); tfree(pBlock->pBlockStatis);
tfree(pBlock); tfree(pBlock);
return NULL; return NULL;
......
...@@ -224,7 +224,7 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) { ...@@ -224,7 +224,7 @@ SArray* createQueryPlanImpl(SQueryInfo* pQueryInfo) {
if (pQueryInfo->numOfTables > 1) { // it is a join query if (pQueryInfo->numOfTables > 1) { // it is a join query
// 1. separate the select clause according to table // 1. separate the select clause according to table
taosArrayDestroy(upstream); taosArrayDestroy(&upstream);
upstream = taosArrayInit(5, POINTER_BYTES); upstream = taosArrayInit(5, POINTER_BYTES);
for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) { for(int32_t i = 0; i < pQueryInfo->numOfTables; ++i) {
...@@ -279,7 +279,7 @@ SQueryNode* qCreateQueryPlan(SQueryInfo* pQueryInfo) { ...@@ -279,7 +279,7 @@ SQueryNode* qCreateQueryPlan(SQueryInfo* pQueryInfo) {
assert(taosArrayGetSize(upstream) == 1); assert(taosArrayGetSize(upstream) == 1);
SQueryNode* p = taosArrayGetP(upstream, 0); SQueryNode* p = taosArrayGetP(upstream, 0);
taosArrayDestroy(upstream); taosArrayDestroy(&upstream);
return p; return p;
} }
...@@ -300,7 +300,7 @@ static void doDestroyQueryNode(SQueryNode* pQueryNode) { ...@@ -300,7 +300,7 @@ static void doDestroyQueryNode(SQueryNode* pQueryNode) {
doDestroyQueryNode(p); doDestroyQueryNode(p);
} }
taosArrayDestroy(pQueryNode->pPrevNodes); taosArrayDestroy(&pQueryNode->pPrevNodes);
} }
tfree(pQueryNode); tfree(pQueryNode);
......
...@@ -433,12 +433,12 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) { ...@@ -433,12 +433,12 @@ void destroyResultBuf(SDiskbasedResultBuf* pResultBuf) {
tfree(pi); tfree(pi);
} }
taosArrayDestroy(*p); taosArrayDestroy(p);
p = taosHashIterate(pResultBuf->groupSet, p); p = taosHashIterate(pResultBuf->groupSet, p);
} }
tdListFree(pResultBuf->lruList); tdListFree(pResultBuf->lruList);
taosArrayDestroy(pResultBuf->emptyDummyIdList); taosArrayDestroy(&pResultBuf->emptyDummyIdList);
taosHashCleanup(pResultBuf->groupSet); taosHashCleanup(pResultBuf->groupSet);
taosHashCleanup(pResultBuf->all); taosHashCleanup(pResultBuf->all);
......
...@@ -117,7 +117,7 @@ void tSqlExprListDestroy(SArray *pList) { ...@@ -117,7 +117,7 @@ void tSqlExprListDestroy(SArray *pList) {
return; return;
} }
taosArrayDestroyEx(pList, freeExprElem); taosArrayDestroyEx(&pList, freeExprElem);
} }
...@@ -687,14 +687,14 @@ void* destroyRelationInfo(SRelationInfo* pRelationInfo) { ...@@ -687,14 +687,14 @@ void* destroyRelationInfo(SRelationInfo* pRelationInfo) {
} }
if (pRelationInfo->type == SQL_NODE_FROM_TABLELIST) { if (pRelationInfo->type == SQL_NODE_FROM_TABLELIST) {
taosArrayDestroy(pRelationInfo->list); taosArrayDestroy(&pRelationInfo->list);
} else { } else {
size_t size = taosArrayGetSize(pRelationInfo->list); size_t size = taosArrayGetSize(pRelationInfo->list);
for(int32_t i = 0; i < size; ++i) { for(int32_t i = 0; i < size; ++i) {
SArray* pa = taosArrayGetP(pRelationInfo->list, i); SArray* pa = taosArrayGetP(pRelationInfo->list, i);
destroyAllSqlNode(pa); destroyAllSqlNode(pa);
} }
taosArrayDestroy(pRelationInfo->list); taosArrayDestroy(&pRelationInfo->list);
} }
tfree(pRelationInfo); tfree(pRelationInfo);
......
...@@ -248,7 +248,7 @@ void* destroyResultRowPool(SResultRowPool* p) { ...@@ -248,7 +248,7 @@ void* destroyResultRowPool(SResultRowPool* p) {
tfree(*ptr); tfree(*ptr);
} }
taosArrayDestroy(p->pData); taosArrayDestroy(&p->pData);
tfree(p); tfree(p);
return NULL; return NULL;
...@@ -341,23 +341,23 @@ void freeInterResult(void* param) { ...@@ -341,23 +341,23 @@ void freeInterResult(void* param) {
int32_t numOfCols = (int32_t) taosArrayGetSize(pResult->pResult); int32_t numOfCols = (int32_t) taosArrayGetSize(pResult->pResult);
for(int32_t i = 0; i < numOfCols; ++i) { for(int32_t i = 0; i < numOfCols; ++i) {
SStddevInterResult *p = taosArrayGet(pResult->pResult, i); SStddevInterResult *p = taosArrayGet(pResult->pResult, i);
taosArrayDestroy(p->pResult); taosArrayDestroy(&p->pResult);
} }
taosArrayDestroy(pResult->pResult); taosArrayDestroy(&pResult->pResult);
} }
void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) { void cleanupGroupResInfo(SGroupResInfo* pGroupResInfo) {
assert(pGroupResInfo != NULL); assert(pGroupResInfo != NULL);
taosArrayDestroy(pGroupResInfo->pRows); taosArrayDestroy(&pGroupResInfo->pRows);
pGroupResInfo->pRows = NULL; pGroupResInfo->pRows = NULL;
pGroupResInfo->index = 0; pGroupResInfo->index = 0;
} }
void initGroupResInfo(SGroupResInfo* pGroupResInfo, SResultRowInfo* pResultInfo) { void initGroupResInfo(SGroupResInfo* pGroupResInfo, SResultRowInfo* pResultInfo) {
if (pGroupResInfo->pRows != NULL) { if (pGroupResInfo->pRows != NULL) {
taosArrayDestroy(pGroupResInfo->pRows); taosArrayDestroy(&pGroupResInfo->pRows);
} }
pGroupResInfo->pRows = taosArrayFromList(pResultInfo->pResult, pResultInfo->size, POINTER_BYTES); pGroupResInfo->pRows = taosArrayFromList(pResultInfo->pResult, pResultInfo->size, POINTER_BYTES);
......
...@@ -54,7 +54,7 @@ void freeParam(SQueryParam *param) { ...@@ -54,7 +54,7 @@ void freeParam(SQueryParam *param) {
tfree(param->sql); tfree(param->sql);
tfree(param->tagCond); tfree(param->tagCond);
tfree(param->pTableIdList); tfree(param->pTableIdList);
taosArrayDestroy(param->pOperator); taosArrayDestroy(&param->pOperator);
tfree(param->pExprs); tfree(param->pExprs);
tfree(param->pSecExprs); tfree(param->pSecExprs);
...@@ -186,15 +186,14 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi ...@@ -186,15 +186,14 @@ int32_t qCreateQueryInfo(void* tsdb, int32_t vgId, SQueryTableMsg* pQueryMsg, qi
_over: _over:
if (param.pGroupbyExpr != NULL) { if (param.pGroupbyExpr != NULL) {
taosArrayDestroy(param.pGroupbyExpr->columnInfo); taosArrayDestroy(&(param.pGroupbyExpr->columnInfo));
} }
tfree(param.colCond); tfree(param.colCond);
destroyUdfInfo(param.pUdfInfo); destroyUdfInfo(param.pUdfInfo);
taosArrayDestroy(param.pTableIdList); taosArrayDestroy(&param.pTableIdList);
param.pTableIdList = NULL;
freeParam(&param); freeParam(&param);
...@@ -714,7 +713,7 @@ void* qObtainLongQuery(void* param){ ...@@ -714,7 +713,7 @@ void* qObtainLongQuery(void* param){
size_t cnt = taosArrayGetSize(qids); size_t cnt = taosArrayGetSize(qids);
if(cnt == 0) { if(cnt == 0) {
taosArrayDestroy(qids); taosArrayDestroy(&qids);
return NULL; return NULL;
} }
if(cnt > 1) if(cnt > 1)
...@@ -754,7 +753,7 @@ bool qFixedNoBlock(void* pRepo, void* pMgmt, int32_t longQueryMs) { ...@@ -754,7 +753,7 @@ bool qFixedNoBlock(void* pRepo, void* pMgmt, int32_t longQueryMs) {
for(i=0; i < cnt; i++) { for(i=0; i < cnt; i++) {
free(taosArrayGetP(qids, i)); free(taosArrayGetP(qids, i));
} }
taosArrayDestroy(qids); taosArrayDestroy(&qids);
return fixed; return fixed;
} }
......
...@@ -892,9 +892,9 @@ static int tsdbInitCommitH(SCommitH *pCommith, STsdbRepo *pRepo) { ...@@ -892,9 +892,9 @@ static int tsdbInitCommitH(SCommitH *pCommith, STsdbRepo *pRepo) {
static void tsdbDestroyCommitH(SCommitH *pCommith) { static void tsdbDestroyCommitH(SCommitH *pCommith) {
pCommith->pDataCols = tdFreeDataCols(pCommith->pDataCols); pCommith->pDataCols = tdFreeDataCols(pCommith->pDataCols);
pCommith->aSubBlk = taosArrayDestroy(pCommith->aSubBlk); pCommith->aSubBlk = taosArrayDestroy(&pCommith->aSubBlk);
pCommith->aSupBlk = taosArrayDestroy(pCommith->aSupBlk); pCommith->aSupBlk = taosArrayDestroy(&pCommith->aSupBlk);
pCommith->aBlkIdx = taosArrayDestroy(pCommith->aBlkIdx); pCommith->aBlkIdx = taosArrayDestroy(&pCommith->aBlkIdx);
tsdbDestroyCommitIters(pCommith); tsdbDestroyCommitIters(pCommith);
tsdbDestroyReadH(&(pCommith->readh)); tsdbDestroyReadH(&(pCommith->readh));
tsdbCloseDFileSet(TSDB_COMMIT_WRITE_FSET(pCommith)); tsdbCloseDFileSet(TSDB_COMMIT_WRITE_FSET(pCommith));
......
...@@ -159,7 +159,7 @@ static SFSStatus *tsdbNewFSStatus(int maxFSet) { ...@@ -159,7 +159,7 @@ static SFSStatus *tsdbNewFSStatus(int maxFSet) {
static SFSStatus *tsdbFreeFSStatus(SFSStatus *pStatus) { static SFSStatus *tsdbFreeFSStatus(SFSStatus *pStatus) {
if (pStatus) { if (pStatus) {
pStatus->df = taosArrayDestroy(pStatus->df); pStatus->df = taosArrayDestroy(&pStatus->df);
free(pStatus); free(pStatus);
} }
...@@ -1139,7 +1139,7 @@ static int tsdbFetchTFileSet(STsdbRepo *pRepo, SArray **fArray) { ...@@ -1139,7 +1139,7 @@ static int tsdbFetchTFileSet(STsdbRepo *pRepo, SArray **fArray) {
if (tdir == NULL) { if (tdir == NULL) {
tsdbError("vgId:%d failed to fetch TFileSet while open directory %s since %s", REPO_ID(pRepo), dataDir, tsdbError("vgId:%d failed to fetch TFileSet while open directory %s since %s", REPO_ID(pRepo), dataDir,
tstrerror(terrno)); tstrerror(terrno));
taosArrayDestroy(*fArray); taosArrayDestroy(fArray);
regfree(&regex); regfree(&regex);
return -1; return -1;
} }
...@@ -1152,7 +1152,7 @@ static int tsdbFetchTFileSet(STsdbRepo *pRepo, SArray **fArray) { ...@@ -1152,7 +1152,7 @@ static int tsdbFetchTFileSet(STsdbRepo *pRepo, SArray **fArray) {
if (taosArrayPush(*fArray, (void *)pf) == NULL) { if (taosArrayPush(*fArray, (void *)pf) == NULL) {
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
tfsClosedir(tdir); tfsClosedir(tdir);
taosArrayDestroy(*fArray); taosArrayDestroy(fArray);
regfree(&regex); regfree(&regex);
return -1; return -1;
} }
...@@ -1166,7 +1166,7 @@ static int tsdbFetchTFileSet(STsdbRepo *pRepo, SArray **fArray) { ...@@ -1166,7 +1166,7 @@ static int tsdbFetchTFileSet(STsdbRepo *pRepo, SArray **fArray) {
tsdbError("vgId:%d failed to fetch TFileSet Array while run regexec since %s", REPO_ID(pRepo), strerror(code)); tsdbError("vgId:%d failed to fetch TFileSet Array while run regexec since %s", REPO_ID(pRepo), strerror(code));
terrno = TAOS_SYSTEM_ERROR(code); terrno = TAOS_SYSTEM_ERROR(code);
tfsClosedir(tdir); tfsClosedir(tdir);
taosArrayDestroy(*fArray); taosArrayDestroy(fArray);
regfree(&regex); regfree(&regex);
return -1; return -1;
} }
...@@ -1207,7 +1207,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1207,7 +1207,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
} }
if ((fArraySize = taosArrayGetSize(fArray)) <= 0) { if ((fArraySize = taosArrayGetSize(fArray)) <= 0) {
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
tsdbInfo("vgId:%d size of DFileSet from %s is %" PRIu32, REPO_ID(pRepo), dataDir, (uint32_t)fArraySize); tsdbInfo("vgId:%d size of DFileSet from %s is %" PRIu32, REPO_ID(pRepo), dataDir, (uint32_t)fArraySize);
return 0; return 0;
} }
...@@ -1258,7 +1258,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1258,7 +1258,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
// return error in case of removing uncomplete DFileSets // return error in case of removing uncomplete DFileSets
terrno = TSDB_CODE_TDB_INCOMPLETE_DFILESET; terrno = TSDB_CODE_TDB_INCOMPLETE_DFILESET;
tsdbError("vgId:%d incomplete DFileSet, fid:%d, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles); tsdbError("vgId:%d incomplete DFileSet, fid:%d, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles);
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
return -1; return -1;
} }
} }
...@@ -1271,7 +1271,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1271,7 +1271,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
// return error in case of removing uncomplete DFileSets // return error in case of removing uncomplete DFileSets
terrno = TSDB_CODE_TDB_INCOMPLETE_DFILESET; terrno = TSDB_CODE_TDB_INCOMPLETE_DFILESET;
tsdbError("vgId:%d incomplete DFileSet, fid:%d, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles); tsdbError("vgId:%d incomplete DFileSet, fid:%d, nDFiles=%" PRIu8, REPO_ID(pRepo), fset.fid, nDFiles);
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
return -1; return -1;
#if 0 #if 0
// next FSet // next FSet
...@@ -1293,14 +1293,14 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1293,14 +1293,14 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
if (tsdbOpenDFile(pDFile1, O_RDONLY) < 0) { if (tsdbOpenDFile(pDFile1, O_RDONLY) < 0) {
tsdbError("vgId:%d failed to open DFile %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile1), tsdbError("vgId:%d failed to open DFile %s since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile1),
tstrerror(terrno)); tstrerror(terrno));
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
return -1; return -1;
} }
if (tsdbLoadDFileHeader(pDFile1, &(pDFile1->info)) < 0) { if (tsdbLoadDFileHeader(pDFile1, &(pDFile1->info)) < 0) {
tsdbError("vgId:%d failed to load DFile %s header since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile1), tsdbError("vgId:%d failed to load DFile %s header since %s", REPO_ID(pRepo), TSDB_FILE_FULL_NAME(pDFile1),
tstrerror(terrno)); tstrerror(terrno));
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
return -1; return -1;
} }
...@@ -1310,7 +1310,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1310,7 +1310,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
// Get real file size // Get real file size
if (fstat(pDFile1->fd, &tfstat) < 0) { if (fstat(pDFile1->fd, &tfstat) < 0) {
terrno = TAOS_SYSTEM_ERROR(errno); terrno = TAOS_SYSTEM_ERROR(errno);
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
return -1; return -1;
} }
...@@ -1346,7 +1346,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) { ...@@ -1346,7 +1346,7 @@ static int tsdbRestoreDFileSet(STsdbRepo *pRepo) {
} }
// Resource release // Resource release
taosArrayDestroy(fArray); taosArrayDestroy(&fArray);
return 0; return 0;
} }
......
...@@ -219,7 +219,7 @@ static void tsdbMayTakeMemSnapshot(STsdbQueryHandle* pQueryHandle, SArray* psTab ...@@ -219,7 +219,7 @@ static void tsdbMayTakeMemSnapshot(STsdbQueryHandle* pQueryHandle, SArray* psTab
tsdbTakeMemSnapshot(pQueryHandle->pTsdb, &(pMemRef->snapshot), psTable); tsdbTakeMemSnapshot(pQueryHandle->pTsdb, &(pMemRef->snapshot), psTable);
} }
taosArrayDestroy(psTable); taosArrayDestroy(&psTable);
} }
static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) { static void tsdbMayUnTakeMemSnapshot(STsdbQueryHandle* pQueryHandle) {
...@@ -277,7 +277,7 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa ...@@ -277,7 +277,7 @@ static SArray* createCheckInfoFromTableGroup(STsdbQueryHandle* pQueryHandle, STa
SArray* pTable = taosArrayInit(4, sizeof(STable*)); SArray* pTable = taosArrayInit(4, sizeof(STable*));
if (pTable == NULL) { if (pTable == NULL) {
taosArrayDestroy(pTableCheckInfo); taosArrayDestroy(&pTableCheckInfo);
return NULL; return NULL;
} }
...@@ -505,7 +505,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable ...@@ -505,7 +505,7 @@ TsdbQueryHandleT* tsdbQueryTables(STsdbRepo* tsdb, STsdbQueryCond* pCond, STable
pQueryHandle->pTableCheckInfo = createCheckInfoFromTableGroup(pQueryHandle, groupList, pMeta, &psTable); pQueryHandle->pTableCheckInfo = createCheckInfoFromTableGroup(pQueryHandle, groupList, pMeta, &psTable);
if (pQueryHandle->pTableCheckInfo == NULL) { if (pQueryHandle->pTableCheckInfo == NULL) {
tsdbCleanupQueryHandle(pQueryHandle); tsdbCleanupQueryHandle(pQueryHandle);
taosArrayDestroy(psTable); taosArrayDestroy(&psTable);
terrno = TSDB_CODE_TDB_OUT_OF_MEMORY; terrno = TSDB_CODE_TDB_OUT_OF_MEMORY;
return NULL; return NULL;
} }
...@@ -3125,7 +3125,7 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM ...@@ -3125,7 +3125,7 @@ static int32_t doGetExternalRow(STsdbQueryHandle* pQueryHandle, int16_t type, SM
SArray* psTable = NULL; SArray* psTable = NULL;
pSecQueryHandle->pTableCheckInfo = createCheckInfoFromCheckInfo(pCurrent, pSecQueryHandle->window.skey, &psTable); pSecQueryHandle->pTableCheckInfo = createCheckInfoFromCheckInfo(pCurrent, pSecQueryHandle->window.skey, &psTable);
if (pSecQueryHandle->pTableCheckInfo == NULL) { if (pSecQueryHandle->pTableCheckInfo == NULL) {
taosArrayDestroy(psTable); taosArrayDestroy(&psTable);
terrno = TSDB_CODE_QRY_OUT_OF_MEMORY; terrno = TSDB_CODE_QRY_OUT_OF_MEMORY;
goto out_of_memory; goto out_of_memory;
} }
...@@ -3331,7 +3331,7 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) { ...@@ -3331,7 +3331,7 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) {
taosArrayPush(pGroup, &keyInfo); taosArrayPush(pGroup, &keyInfo);
} }
} else { // mark all the empty groups, and remove it later } else { // mark all the empty groups, and remove it later
taosArrayDestroy(pGroup); taosArrayDestroy(&pGroup);
taosArrayPush(emptyGroup, &j); taosArrayPush(emptyGroup, &j);
} }
} }
...@@ -3343,7 +3343,7 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) { ...@@ -3343,7 +3343,7 @@ STimeWindow updateLastrowForEachGroup(STableGroupInfo *groupList) {
} }
taosArrayRemoveBatch(groupList->pGroupList, TARRAY_GET_START(emptyGroup), (int32_t) taosArrayGetSize(emptyGroup)); taosArrayRemoveBatch(groupList->pGroupList, TARRAY_GET_START(emptyGroup), (int32_t) taosArrayGetSize(emptyGroup));
taosArrayDestroy(emptyGroup); taosArrayDestroy(&emptyGroup);
groupList->numOfTables = totalNumOfTable; groupList->numOfTables = totalNumOfTable;
return window; return window;
......
...@@ -74,7 +74,7 @@ void tsdbDestroyReadH(SReadH *pReadh) { ...@@ -74,7 +74,7 @@ void tsdbDestroyReadH(SReadH *pReadh) {
pReadh->cidx = 0; pReadh->cidx = 0;
pReadh->pBlkIdx = NULL; pReadh->pBlkIdx = NULL;
pReadh->pTable = NULL; pReadh->pTable = NULL;
pReadh->aBlkIdx = taosArrayDestroy(pReadh->aBlkIdx); pReadh->aBlkIdx = taosArrayDestroy(&pReadh->aBlkIdx);
tsdbCloseDFileSet(TSDB_READ_FSET(pReadh)); tsdbCloseDFileSet(TSDB_READ_FSET(pReadh));
pReadh->pRepo = NULL; pReadh->pRepo = NULL;
} }
......
...@@ -176,7 +176,7 @@ void taosArrayClear(SArray* pArray); ...@@ -176,7 +176,7 @@ void taosArrayClear(SArray* pArray);
* destroy array list * destroy array list
* @param pArray * @param pArray
*/ */
void* taosArrayDestroy(SArray* pArray); void* taosArrayDestroy(SArray** pArray);
/** /**
* destroy array list for hash * destroy array list for hash
...@@ -189,7 +189,7 @@ void taosArrayDestroyForHash(void* para); ...@@ -189,7 +189,7 @@ void taosArrayDestroyForHash(void* para);
* @param pArray * @param pArray
* @param fp * @param fp
*/ */
void taosArrayDestroyEx(SArray* pArray, void (*fp)(void*)); void taosArrayDestroyEx(SArray** pArray, void (*fp)(void*));
/** /**
* sort the array * sort the array
......
...@@ -614,7 +614,7 @@ void taosHashCleanup(SHashObj *pHashObj) { ...@@ -614,7 +614,7 @@ void taosHashCleanup(SHashObj *pHashObj) {
tfree(p); tfree(p);
} }
taosArrayDestroy(pHashObj->pMemBlock); taosArrayDestroy(&pHashObj->pMemBlock);
memset(pHashObj, 0, sizeof(SHashObj)); memset(pHashObj, 0, sizeof(SHashObj));
tfree(pHashObj); tfree(pHashObj);
......
...@@ -279,10 +279,10 @@ void taosArrayClear(SArray* pArray) { ...@@ -279,10 +279,10 @@ void taosArrayClear(SArray* pArray) {
pArray->size = 0; pArray->size = 0;
} }
void* taosArrayDestroy(SArray* pArray) { void* taosArrayDestroy(SArray** pArray) {
if (pArray) { if (*pArray) {
tfree(pArray->pData); tfree((*pArray)->pData);
tfree(pArray); tfree(*pArray);
} }
return NULL; return NULL;
...@@ -292,17 +292,16 @@ void taosArrayDestroyForHash(void* para) { ...@@ -292,17 +292,16 @@ void taosArrayDestroyForHash(void* para) {
SArray** ppArray = (SArray**)para; SArray** ppArray = (SArray**)para;
if(ppArray == NULL) return; if(ppArray == NULL) return;
SArray* pArray = *ppArray; if (*ppArray) {
if (pArray) { tfree((*ppArray)->pData);
tfree(pArray->pData); tfree(*ppArray);
tfree(pArray);
} }
return; return;
} }
void taosArrayDestroyEx(SArray* pArray, void (*fp)(void*)) { void taosArrayDestroyEx(SArray** pArray, void (*fp)(void*)) {
if (pArray == NULL) { if (*pArray == NULL) {
return; return;
} }
...@@ -311,8 +310,8 @@ void taosArrayDestroyEx(SArray* pArray, void (*fp)(void*)) { ...@@ -311,8 +310,8 @@ void taosArrayDestroyEx(SArray* pArray, void (*fp)(void*)) {
return; return;
} }
for(int32_t i = 0; i < pArray->size; ++i) { for(int32_t i = 0; i < (*pArray)->size; ++i) {
fp(TARRAY_GET_ELEM(pArray, i)); fp(TARRAY_GET_ELEM(*pArray, i));
} }
taosArrayDestroy(pArray); taosArrayDestroy(pArray);
......
...@@ -757,7 +757,7 @@ void* taosCacheTimedRefresh(void *handle) { ...@@ -757,7 +757,7 @@ void* taosCacheTimedRefresh(void *handle) {
} }
_end: _end:
taosArrayDestroy(pCacheArrayList); taosArrayDestroy(&pCacheArrayList);
pCacheArrayList = NULL; pCacheArrayList = NULL;
pthread_mutex_destroy(&guard); pthread_mutex_destroy(&guard);
......
...@@ -300,7 +300,7 @@ void duplicatedKeyTest() { ...@@ -300,7 +300,7 @@ void duplicatedKeyTest() {
SSkipListKey key; SSkipListKey key;
SArray* nodes = tSkipListGet(pSkipList, (char*)(&i)); SArray* nodes = tSkipListGet(pSkipList, (char*)(&i));
assert( taosArrayGetSize(nodes) == 5 ); assert( taosArrayGetSize(nodes) == 5 );
taosArrayDestroy(nodes); taosArrayDestroy(&nodes);
} }
int32_t key = 101; int32_t key = 101;
...@@ -309,7 +309,7 @@ void duplicatedKeyTest() { ...@@ -309,7 +309,7 @@ void duplicatedKeyTest() {
SArray* nodes = tSkipListGet(pSkipList, (char*)(&key)); SArray* nodes = tSkipListGet(pSkipList, (char*)(&key));
assert( taosArrayGetSize(nodes) == 0 ); assert( taosArrayGetSize(nodes) == 0 );
taosArrayDestroy(nodes); taosArrayDestroy(&nodes);
key = 102; key = 102;
SSkipListIterator* iter = tSkipListCreateIterFromVal(pSkipList, (char*)(&key), TSDB_DATA_TYPE_INT, TSDB_ORDER_ASC); SSkipListIterator* iter = tSkipListCreateIterFromVal(pSkipList, (char*)(&key), TSDB_DATA_TYPE_INT, TSDB_ORDER_ASC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册