diff options
author | pat <> | 2005-03-30 18:51:49 +0000 |
---|---|---|
committer | pat <> | 2005-03-30 18:51:49 +0000 |
commit | 894b6ab0099e7d9ca2ad9acb75246cd0a4542167 (patch) | |
tree | f9fb8e9324f6cbdc10d72cab8b889d470252465a /src/lib/libc/stdlib/radixsort.c | |
parent | 162f8b042bf31ab94714a6f194e9836c08c085f5 (diff) | |
download | openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.tar.gz openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.tar.bz2 openbsd-894b6ab0099e7d9ca2ad9acb75246cd0a4542167.zip |
ansi + de-register
ok otto deraadt
Diffstat (limited to 'src/lib/libc/stdlib/radixsort.c')
-rw-r--r-- | src/lib/libc/stdlib/radixsort.c | 42 |
1 files changed, 13 insertions, 29 deletions
diff --git a/src/lib/libc/stdlib/radixsort.c b/src/lib/libc/stdlib/radixsort.c index 1ff30416d9..96392ea73a 100644 --- a/src/lib/libc/stdlib/radixsort.c +++ b/src/lib/libc/stdlib/radixsort.c | |||
@@ -31,7 +31,7 @@ | |||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #if defined(LIBC_SCCS) && !defined(lint) | 33 | #if defined(LIBC_SCCS) && !defined(lint) |
34 | static char *rcsid = "$OpenBSD: radixsort.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; | 34 | static char *rcsid = "$OpenBSD: radixsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $"; |
35 | #endif /* LIBC_SCCS and not lint */ | 35 | #endif /* LIBC_SCCS and not lint */ |
36 | 36 | ||
37 | /* | 37 | /* |
@@ -85,10 +85,7 @@ static void r_sort_b(const u_char **, | |||
85 | } | 85 | } |
86 | 86 | ||
87 | int | 87 | int |
88 | radixsort(a, n, tab, endch) | 88 | radixsort(const u_char **a, int n, const u_char *tab, u_int endch) |
89 | const u_char **a, *tab; | ||
90 | int n; | ||
91 | u_int endch; | ||
92 | { | 89 | { |
93 | const u_char *tr; | 90 | const u_char *tr; |
94 | int c; | 91 | int c; |
@@ -100,10 +97,7 @@ radixsort(a, n, tab, endch) | |||
100 | } | 97 | } |
101 | 98 | ||
102 | int | 99 | int |
103 | sradixsort(a, n, tab, endch) | 100 | sradixsort(const u_char **a, int n, const u_char *tab, u_int endch) |
104 | const u_char **a, *tab; | ||
105 | int n; | ||
106 | u_int endch; | ||
107 | { | 101 | { |
108 | const u_char *tr, **ta; | 102 | const u_char *tr, **ta; |
109 | int c; | 103 | int c; |
@@ -128,15 +122,11 @@ sradixsort(a, n, tab, endch) | |||
128 | 122 | ||
129 | /* Unstable, in-place sort. */ | 123 | /* Unstable, in-place sort. */ |
130 | void | 124 | void |
131 | r_sort_a(a, n, i, tr, endch) | 125 | r_sort_a(const u_char **a, int n, int i, const u_char *tr, u_int endch) |
132 | const u_char **a; | ||
133 | int n, i; | ||
134 | const u_char *tr; | ||
135 | u_int endch; | ||
136 | { | 126 | { |
137 | static int count[256], nc, bmin; | 127 | static int count[256], nc, bmin; |
138 | register int c; | 128 | int c; |
139 | register const u_char **ak, *r; | 129 | const u_char **ak, *r; |
140 | stack s[SIZE], *sp, *sp0, *sp1, temp; | 130 | stack s[SIZE], *sp, *sp0, *sp1, temp; |
141 | int *cp, bigc; | 131 | int *cp, bigc; |
142 | const u_char **an, *t, **aj, **top[256]; | 132 | const u_char **an, *t, **aj, **top[256]; |
@@ -219,15 +209,12 @@ r_sort_a(a, n, i, tr, endch) | |||
219 | 209 | ||
220 | /* Stable sort, requiring additional memory. */ | 210 | /* Stable sort, requiring additional memory. */ |
221 | void | 211 | void |
222 | r_sort_b(a, ta, n, i, tr, endch) | 212 | r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr, |
223 | const u_char **a, **ta; | 213 | u_int endch) |
224 | int n, i; | ||
225 | const u_char *tr; | ||
226 | u_int endch; | ||
227 | { | 214 | { |
228 | static int count[256], nc, bmin; | 215 | static int count[256], nc, bmin; |
229 | register int c; | 216 | int c; |
230 | register const u_char **ak, **ai; | 217 | const u_char **ak, **ai; |
231 | stack s[512], *sp, *sp0, *sp1, temp; | 218 | stack s[512], *sp, *sp0, *sp1, temp; |
232 | const u_char **top[256]; | 219 | const u_char **top[256]; |
233 | int *cp, bigc; | 220 | int *cp, bigc; |
@@ -291,13 +278,10 @@ r_sort_b(a, ta, n, i, tr, endch) | |||
291 | } | 278 | } |
292 | 279 | ||
293 | static __inline void | 280 | static __inline void |
294 | simplesort(a, n, b, tr, endch) /* insertion sort */ | 281 | simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch) |
295 | register const u_char **a; | 282 | /* insertion sort */ |
296 | int n, b; | ||
297 | register const u_char *tr; | ||
298 | u_int endch; | ||
299 | { | 283 | { |
300 | register u_char ch; | 284 | u_char ch; |
301 | const u_char **ak, **ai, *s, *t; | 285 | const u_char **ak, **ai, *s, *t; |
302 | 286 | ||
303 | for (ak = a+1; --n >= 1; ak++) | 287 | for (ak = a+1; --n >= 1; ak++) |