]>
Commit | Line | Data |
---|---|---|
1 | --- merge_b.c.orig 2008-05-21 02:51:18.000000000 -0700 | |
2 | +++ merge_b.c 2008-05-21 02:54:59.000000000 -0700 | |
3 | @@ -57,9 +57,9 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/ | |
4 | #include <string.h> | |
5 | ||
6 | static void setup(u_char *, u_char *, size_t, size_t, | |
7 | - int (*)(const void *, const void *)); | |
8 | + int (^)(const void *, const void *)); | |
9 | static void insertionsort(u_char *, size_t, size_t, | |
10 | - int (*)(const void *, const void *)); | |
11 | + int (^)(const void *, const void *)); | |
12 | ||
13 | #define ISIZE sizeof(int) | |
14 | #define PSIZE sizeof(u_char *) | |
15 | @@ -95,11 +95,11 @@ static void insertionsort(u_char *, size | |
16 | * Arguments are as for qsort. | |
17 | */ | |
18 | int | |
19 | -mergesort(base, nmemb, size, cmp) | |
20 | +mergesort_b(base, nmemb, size, cmp) | |
21 | void *base; | |
22 | size_t nmemb; | |
23 | size_t size; | |
24 | - int (*cmp)(const void *, const void *); | |
25 | + int (^cmp)(const void *, const void *); | |
26 | { | |
27 | size_t i; | |
28 | int sense; | |
29 | @@ -141,7 +141,7 @@ mergesort(base, nmemb, size, cmp) | |
30 | p2 = *EVAL(p2); | |
31 | l2 = list1 + (p2 - list2); | |
32 | while (f1 < l1 && f2 < l2) { | |
33 | - if ((*cmp)(f1, f2) <= 0) { | |
34 | + if (cmp(f1, f2) <= 0) { | |
35 | q = f2; | |
36 | b = f1, t = l1; | |
37 | sense = -1; | |
38 | @@ -160,12 +160,12 @@ mergesort(base, nmemb, size, cmp) | |
39 | EXPONENTIAL: for (i = size; ; i <<= 1) | |
40 | if ((p = (b + i)) >= t) { | |
41 | if ((p = t - size) > b && | |
42 | - (*cmp)(q, p) <= sense) | |
43 | + cmp(q, p) <= sense) | |
44 | t = p; | |
45 | else | |
46 | b = p; | |
47 | break; | |
48 | - } else if ((*cmp)(q, p) <= sense) { | |
49 | + } else if (cmp(q, p) <= sense) { | |
50 | t = p; | |
51 | if (i == size) | |
52 | big = 0; | |
53 | @@ -174,14 +174,14 @@ EXPONENTIAL: for (i = size; ; i << | |
54 | b = p; | |
55 | while (t > b+size) { | |
56 | i = (((t - b) / size) >> 1) * size; | |
57 | - if ((*cmp)(q, p = b + i) <= sense) | |
58 | + if (cmp(q, p = b + i) <= sense) | |
59 | t = p; | |
60 | else | |
61 | b = p; | |
62 | } | |
63 | goto COPY; | |
64 | FASTCASE: while (i > size) | |
65 | - if ((*cmp)(q, | |
66 | + if (cmp(q, | |
67 | p = b + (i >>= 1)) <= sense) | |
68 | t = p; | |
69 | else | |
70 | @@ -261,10 +261,11 @@ COPY: b = t; | |
71 | void | |
72 | setup(list1, list2, n, size, cmp) | |
73 | size_t n, size; | |
74 | - int (*cmp)(const void *, const void *); | |
75 | + int (^cmp)(const void *, const void *); | |
76 | u_char *list1, *list2; | |
77 | { | |
78 | - int i, length, size2, tmp, sense; | |
79 | + size_t i, size2; | |
80 | + int length, tmp, sense; | |
81 | u_char *f1, *f2, *s, *l2, *last, *p2; | |
82 | ||
83 | size2 = size*2; | |
84 | @@ -336,7 +337,7 @@ static void | |
85 | insertionsort(a, n, size, cmp) | |
86 | u_char *a; | |
87 | size_t n, size; | |
88 | - int (*cmp)(const void *, const void *); | |
89 | + int (^cmp)(const void *, const void *); | |
90 | { | |
91 | u_char *ai, *s, *t, *u, tmp; | |
92 | int i; |