diff options
author | Alan Modra <amodra@gmail.com> | 2009-09-07 12:11:20 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2009-09-07 12:11:20 +0000 |
commit | eae14d64d117e16e474dfcf35353c50ce4a22fb5 (patch) | |
tree | c5b3bb496f3aa767051ac35d6eeaf962e64fcff4 /opcodes/z8kgen.c | |
parent | 23f938f12a8dc9b1e381da18c1e7657f2d32d506 (diff) | |
download | gdb-eae14d64d117e16e474dfcf35353c50ce4a22fb5.zip gdb-eae14d64d117e16e474dfcf35353c50ce4a22fb5.tar.gz gdb-eae14d64d117e16e474dfcf35353c50ce4a22fb5.tar.bz2 |
* z8kgen.c (func): Stabilize qsort of identically named entries.
* z8k-opc.h: Regenerate.
Diffstat (limited to 'opcodes/z8kgen.c')
-rw-r--r-- | opcodes/z8kgen.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/opcodes/z8kgen.c b/opcodes/z8kgen.c index 2012bc4..cbd316d 100644 --- a/opcodes/z8kgen.c +++ b/opcodes/z8kgen.c @@ -567,9 +567,14 @@ count (void) } static int -func (struct op *a, struct op *b) +func (const void *p1, const void *p2) { - return strcmp ((a)->name, (b)->name); + const struct op *a = p1; + const struct op *b = p2; + int ret = strcmp (a->name, b->name); + if (ret != 0) + return ret; + return p1 > p2; } @@ -909,7 +914,7 @@ internal (void) memcpy (new_op, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new_op, c, sizeof (struct op), (int (*)(const void *, const void *))func); + qsort (new_op, c, sizeof (struct op), func); p = new_op; while (p->flags && p->flags[0] != '*') @@ -965,7 +970,7 @@ gas (void) memcpy (new_op, p, c * sizeof (struct op)); /* Sort all names in table alphabetically. */ - qsort (new_op, c, sizeof (struct op), (int (*)(const void *, const void *)) func); + qsort (new_op, c, sizeof (struct op), func); printf ("/* DO NOT EDIT! -*- buffer-read-only: t -*-\n"); printf (" This file is automatically generated by z8kgen. */\n\n"); |