提交 782dd229 编写于 作者: W Wang Huaqiang 提交者: Michal Privoznik

util: Refactor and rename 'virResctrlMonitorFreeStats'

Refactor and rename 'virResctrlMonitorFreeStats' to
'virResctrlMonitorStatsFree' to free one
'virResctrlMonitorStatsPtr' object.
Signed-off-by: NWang Huaqiang <huaqiang.wang@intel.com>
Reviewed-by: NMichal Privoznik <mprivozn@redhat.com>
上级 6d7d7985
......@@ -2833,13 +2833,13 @@ virResctrlInfoNew;
virResctrlMonitorAddPID;
virResctrlMonitorCreate;
virResctrlMonitorDeterminePath;
virResctrlMonitorFreeStats;
virResctrlMonitorGetCacheOccupancy;
virResctrlMonitorGetID;
virResctrlMonitorNew;
virResctrlMonitorRemove;
virResctrlMonitorSetAlloc;
virResctrlMonitorSetID;
virResctrlMonitorStatsFree;
# util/virrotatingfile.h
......
......@@ -20696,9 +20696,13 @@ struct _virQEMUResctrlMonData {
static void
qemuDomainFreeResctrlMonData(virQEMUResctrlMonDataPtr resdata)
{
size_t i = 0;
VIR_FREE(resdata->name);
VIR_FREE(resdata->vcpus);
virResctrlMonitorFreeStats(resdata->stats, resdata->nstats);
for (i = 0; i < resdata->nstats; i++)
virResctrlMonitorStatsFree(resdata->stats[i]);
VIR_FREE(resdata->stats);
VIR_FREE(resdata);
}
......
......@@ -2765,25 +2765,19 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
cleanup:
VIR_FREE(datapath);
VIR_FREE(filepath);
VIR_FREE(stat);
virResctrlMonitorStatsFree(stat);
VIR_DIR_CLOSE(dirp);
return ret;
}
void
virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats,
size_t nstats)
virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr stat)
{
size_t i = 0;
if (!stats)
if (!stat)
return;
for (i = 0; i < nstats; i++)
VIR_FREE(stats[i]);
VIR_FREE(stats);
VIR_FREE(stat);
}
......
......@@ -232,5 +232,4 @@ virResctrlMonitorGetCacheOccupancy(virResctrlMonitorPtr monitor,
size_t *nstats);
void
virResctrlMonitorFreeStats(virResctrlMonitorStatsPtr *stats,
size_t nstats);
virResctrlMonitorStatsFree(virResctrlMonitorStatsPtr stats);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册