mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +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,
|
||||
const void *b)
|
||||
{
|
||||
return ((virResctrlMonitorStatsPtr)a)->id
|
||||
- ((virResctrlMonitorStatsPtr)b)->id;
|
||||
return (*(virResctrlMonitorStatsPtr *)a)->id
|
||||
- (*(virResctrlMonitorStatsPtr *)b)->id;
|
||||
}
|
||||
|
||||
|
||||
@ -2758,7 +2758,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monitor,
|
||||
|
||||
/* Sort in id's ascending order */
|
||||
if (*nstats)
|
||||
qsort(*stats, *nstats, sizeof(*stat), virResctrlMonitorStatsSorter);
|
||||
qsort(*stats, *nstats, sizeof(**stats), virResctrlMonitorStatsSorter);
|
||||
|
||||
ret = 0;
|
||||
cleanup:
|
||||
|
Loading…
Reference in New Issue
Block a user