[binutils-gdb] gas m68hc11 use standard qsort predicate signature
Alan Modra
amodra@sourceware.org
Tue Jun 10 22:01:00 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a9671a290ddd162fea7cb4721fed7b61664dbef0
commit a9671a290ddd162fea7cb4721fed7b61664dbef0
Author: Alan Modra <amodra@gmail.com>
Date: Tue Jun 10 11:12:49 2025 +0930
gas m68hc11 use standard qsort predicate signature
Avoid a function cast when using cmp_opcode with qsort.
Diff:
---
gas/config/tc-m68hc11.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c
index 41bf9c37472..6950c572411 100644
--- a/gas/config/tc-m68hc11.c
+++ b/gas/config/tc-m68hc11.c
@@ -189,7 +189,6 @@ struct m9s12xg_opcode_def
/* Local functions. */
static register_id reg_name_search (char *);
static register_id register_name (void);
-static int cmp_opcode (struct m68hc11_opcode *, struct m68hc11_opcode *);
static char *print_opcode_format (struct m68hc11_opcode *, int);
static char *skip_whites (char *);
static int check_range (long, int);
@@ -588,8 +587,10 @@ md_section_align (asection *seg, valueT addr)
}
static int
-cmp_opcode (struct m68hc11_opcode *op1, struct m68hc11_opcode *op2)
+cmp_opcode (const void *p1, const void *p2)
{
+ const struct m68hc11_opcode *op1 = p1;
+ const struct m68hc11_opcode *op2 = p2;
return strcmp (op1->name, op2->name);
}
@@ -639,8 +640,7 @@ md_begin (void)
}
}
}
- qsort (opcodes, num_opcodes, sizeof (struct m68hc11_opcode),
- (int (*) (const void*, const void*)) cmp_opcode);
+ qsort (opcodes, num_opcodes, sizeof (struct m68hc11_opcode), cmp_opcode);
opc = XNEWVEC (struct m68hc11_opcode_def, num_opcodes);
m68hc11_opcode_defs = opc;
More information about the Binutils-cvs
mailing list