Make power sort countries of equal power predictably
How qsort() sorts members that compare equal is unspecified. Can upset the smoke test. Observed under FreeBSD 8.3. Break ties in power by comparing country numbers. Countries equal in power are now sorted by increasing country number.
This commit is contained in:
parent
c798863bd7
commit
335dd1b974
1 changed files with 1 additions and 1 deletions
|
@ -337,7 +337,7 @@ powcmp(const void *a, const void *b)
|
|||
return -1;
|
||||
if (p1->p_power < p2->p_power)
|
||||
return 1;
|
||||
return 0;
|
||||
return p1->p_nation - p2->p_nation;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue