This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch] opcodes/z8k-opc.h regenerated



On Sep 7, 2009, at 2:17 PM, Andreas Schwab wrote:


Alan Modra <amodra@bigpond.net.au> writes:

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;

Shouldn't that handle p1 < p2 as well?

(You reply to Alan but it is not explicitly listed as a recipient !)


Or:

return (p1 > p2) * 2 - 1;

Tristan.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]