roken: Fix mergesort_r() clang-13 build

This commit is contained in:
Nicolas Williams
2022-01-02 20:53:09 -06:00
parent 957633b793
commit a849015350

View File

@@ -85,7 +85,7 @@ static void insertionsort(u_char *, size_t, size_t, cmp_t, void *);
*/ */
/* Assumption: PSIZE is a power of 2. */ /* Assumption: PSIZE is a power of 2. */
#define EVAL(p) (u_char **) \ #define EVAL(p) (u_char **) \
((((u_char *)p + PSIZE - 1 - (u_char *) 0) & ~(PSIZE - 1))) ((((uintptr_t)p + PSIZE - 1) & ~(PSIZE - 1)))
/* /*
* Arguments are as for qsort_r, except thunk is moved to the last * Arguments are as for qsort_r, except thunk is moved to the last
@@ -114,7 +114,7 @@ mergesort_r(void *base, size_t nmemb, size_t size, cmp_t cmp, void *thunk)
* Stupid subtraction for the Cray. * Stupid subtraction for the Cray.
*/ */
iflag = 0; iflag = 0;
if (!(size % ISIZE) && !(((char *)base - (char *)0) % ISIZE)) if (!(size % ISIZE) && !(((uintptr_t)base) % ISIZE))
iflag = 1; iflag = 1;
if ((list2 = malloc(nmemb * size + PSIZE)) == NULL) if ((list2 = malloc(nmemb * size + PSIZE)) == NULL)