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

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

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