}
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;
}
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] != '*')
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");