mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-18 12:08:18 +00:00
nshlib: fix top command sorting result error
qsort expects the return value to be -1,0,1 Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
parent
b022a71480
commit
15b081f02d
1 changed files with 6 additions and 2 deletions
|
|
@ -780,12 +780,16 @@ static int top_cmpcpuload(FAR const void *item1, FAR const void *item2)
|
|||
s2 = status2->td_cpuload;
|
||||
while (*s1++ != '.');
|
||||
while (*s2++ != '.');
|
||||
if (*s2 == *s1)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return *s2 > *s1;
|
||||
return *s2 > *s1 ? 1 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return load2 > load1;
|
||||
return load2 > load1 ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue