This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch] opcodes/z8k-opc.h regenerated
On Mon, Sep 07, 2009 at 02:17:02PM +0200, 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?
Oops. I ought to know better.
* z8kgen.c (func): Fix thinko last patch.
Index: opcodes/z8kgen.c
===================================================================
RCS file: /cvs/src/src/opcodes/z8kgen.c,v
retrieving revision 1.17
diff -u -p -r1.17 z8kgen.c
--- opcodes/z8kgen.c 7 Sep 2009 12:11:20 -0000 1.17
+++ opcodes/z8kgen.c 7 Sep 2009 12:59:39 -0000
@@ -574,7 +574,7 @@ func (const void *p1, const void *p2)
int ret = strcmp (a->name, b->name);
if (ret != 0)
return ret;
- return p1 > p2;
+ return p1 > p2 ? 1 : -1;
}
--
Alan Modra
Australia Development Lab, IBM