mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-12 07:42:56 +00:00
virresctrl: Sort resctrl array correctly in virResctrlMonitorGetStats()
The qsort element is a pointer of virResctrlMonitorStats, and the comparing function's arguments have a type of pointer of virResctrlMonitorStatsPtr. Signed-off-by: Huaqiang <huaqiang.wang@intel.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
d55be92286
commit
e34c028af1
@ -2659,8 +2659,8 @@ static int
|
|||||||
virResctrlMonitorStatsSorter(const void *a,
|
virResctrlMonitorStatsSorter(const void *a,
|
||||||
const void *b)
|
const void *b)
|
||||||
{
|
{
|
||||||
return ((virResctrlMonitorStatsPtr)a)->id
|
return (*(virResctrlMonitorStatsPtr *)a)->id
|
||||||
- ((virResctrlMonitorStatsPtr)b)->id;
|
- (*(virResctrlMonitorStatsPtr *)b)->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2758,7 +2758,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
|
|||||||
|
|
||||||
/* Sort in id's ascending order */
|
/* Sort in id's ascending order */
|
||||||
if (*nstats)
|
if (*nstats)
|
||||||
qsort(*stats, *nstats, sizeof(*stat), virResctrlMonitorStatsSorter);
|
qsort(*stats, *nstats, sizeof(**stats), virResctrlMonitorStatsSorter);
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user