Loading...
stdlib/FreeBSD/heapsort_r.c.patch Libc-583 /dev/null
--- Libc/Libc-583/stdlib/FreeBSD/heapsort_r.c.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- heapsort_r.c.orig	2008-09-24 13:48:45.000000000 -0700
-+++ heapsort_r.c	2008-09-24 13:59:08.000000000 -0700
-@@ -77,12 +77,12 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- 	for (par_i = initval; (child_i = par_i * 2) <= nmemb; \
- 	    par_i = child_i) { \
- 		child = base + child_i * size; \
--		if (child_i < nmemb && compar(child, child + size) < 0) { \
-+		if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
- 			child += size; \
- 			++child_i; \
- 		} \
- 		par = base + par_i * size; \
--		if (compar(child, par) <= 0) \
-+		if (compar(thunk, child, par) <= 0) \
- 			break; \
- 		SWAP(par, child, count, size, tmp); \
- 	} \
-@@ -108,7 +108,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- #define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \
- 	for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \
- 		child = base + child_i * size; \
--		if (child_i < nmemb && compar(child, child + size) < 0) { \
-+		if (child_i < nmemb && compar(thunk, child, child + size) < 0) { \
- 			child += size; \
- 			++child_i; \
- 		} \
-@@ -120,7 +120,7 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
- 		par_i = child_i / 2; \
- 		child = base + child_i * size; \
- 		par = base + par_i * size; \
--		if (child_i == 1 || compar(k, par) < 0) { \
-+		if (child_i == 1 || compar(thunk, k, par) < 0) { \
- 			COPY(child, k, count, size, tmp1, tmp2); \
- 			break; \
- 		} \
-@@ -135,11 +135,12 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
-  * a data set that will trigger the worst case is nonexistent.  Heapsort's
-  * only advantage over quicksort is that it requires little additional memory.
-  */
--int
--heapsort(vbase, nmemb, size, compar)
-+__private_extern__ int
-+__heapsort_r(vbase, nmemb, size, thunk, compar)
- 	void *vbase;
- 	size_t nmemb, size;
--	int (*compar)(const void *, const void *);
-+	void *thunk;
-+	int (*compar)(void *, const void *, const void *);
- {
- 	size_t cnt, i, j, l;
- 	char tmp, *tmp1, *tmp2;