tree-wide: use typesafe_qsort()

This commit is contained in:
Yu Watanabe
2018-09-19 08:02:52 +09:00
parent 6058516a14
commit 93bab28895
35 changed files with 243 additions and 374 deletions
+3 -11
View File
@@ -10,16 +10,8 @@
#define SET_SIZE 1024*4
static int unsigned_compare(const void *a, const void *b) {
const unsigned *x = a, *y = b;
if (*x < *y)
return -1;
if (*x > *y)
return 1;
return 0;
static int unsigned_compare(const unsigned *a, const unsigned *b) {
return CMP(*a, *b);
}
static void test_unsigned(void) {
@@ -39,7 +31,7 @@ static void test_unsigned(void) {
assert_se(prioq_put(q, UINT_TO_PTR(u), NULL) >= 0);
}
qsort(buffer, ELEMENTSOF(buffer), sizeof(buffer[0]), unsigned_compare);
typesafe_qsort(buffer, ELEMENTSOF(buffer), unsigned_compare);
for (i = 0; i < ELEMENTSOF(buffer); i++) {
unsigned u;