diff --git a/src/lib/libc/stdlib/a64l.c b/src/lib/libc/stdlib/a64l.c index a68f0a6d..518bdb64 100644 --- a/src/lib/libc/stdlib/a64l.c +++ b/src/lib/libc/stdlib/a64l.c @@ -4,15 +4,14 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: a64l.c,v 1.3 1997/08/17 22:58:34 millert Exp $"; +static char *rcsid = "$OpenBSD: a64l.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include long -a64l(s) - const char *s; +a64l(const char *s) { long value, digit, shift; int i; diff --git a/src/lib/libc/stdlib/abs.c b/src/lib/libc/stdlib/abs.c index c67ad949..a471ab3a 100644 --- a/src/lib/libc/stdlib/abs.c +++ b/src/lib/libc/stdlib/abs.c @@ -28,14 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: abs.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: abs.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include int -abs(j) - int j; +abs(int j) { return(j < 0 ? -j : j); } diff --git a/src/lib/libc/stdlib/atexit.c b/src/lib/libc/stdlib/atexit.c index 98564d0d..4fd2c573 100644 --- a/src/lib/libc/stdlib/atexit.c +++ b/src/lib/libc/stdlib/atexit.c @@ -29,7 +29,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: atexit.c,v 1.7 2002/09/14 22:03:14 dhartmei Exp $"; +static char *rcsid = "$OpenBSD: atexit.c,v 1.8 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -59,11 +59,10 @@ struct atexit *__atexit; * Register a function to be performed at exit. */ int -atexit(fn) - void (*fn)(); +atexit(void (*fn)(void)) { - register struct atexit *p = __atexit; - register int pgsize = getpagesize(); + struct atexit *p = __atexit; + int pgsize = getpagesize(); if (pgsize < sizeof(*p)) return (-1); @@ -102,11 +101,10 @@ atexit(fn) * Register the cleanup function */ void -__atexit_register_cleanup(fn) - void (*fn)(); +__atexit_register_cleanup(void (*fn)(void)) { - register struct atexit *p = __atexit; - register int pgsize = getpagesize(); + struct atexit *p = __atexit; + int pgsize = getpagesize(); if (pgsize < sizeof(*p)) return; diff --git a/src/lib/libc/stdlib/atof.c b/src/lib/libc/stdlib/atof.c index dad2b77b..27245302 100644 --- a/src/lib/libc/stdlib/atof.c +++ b/src/lib/libc/stdlib/atof.c @@ -28,14 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: atof.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: atof.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include double -atof(ascii) - const char *ascii; +atof(const char *ascii) { return(strtod(ascii, (char **)NULL)); } diff --git a/src/lib/libc/stdlib/atoi.c b/src/lib/libc/stdlib/atoi.c index b1fe789f..ea821ced 100644 --- a/src/lib/libc/stdlib/atoi.c +++ b/src/lib/libc/stdlib/atoi.c @@ -28,14 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: atoi.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: atoi.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include int -atoi(str) - const char *str; +atoi(const char *str) { return((int)strtol(str, (char **)NULL, 10)); } diff --git a/src/lib/libc/stdlib/atol.c b/src/lib/libc/stdlib/atol.c index 83adad3e..38236b55 100644 --- a/src/lib/libc/stdlib/atol.c +++ b/src/lib/libc/stdlib/atol.c @@ -28,14 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: atol.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: atol.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include long -atol(str) - const char *str; +atol(const char *str) { return(strtol(str, (char **)NULL, 10)); } diff --git a/src/lib/libc/stdlib/bsearch.c b/src/lib/libc/stdlib/bsearch.c index 9bfbf642..109211da 100644 --- a/src/lib/libc/stdlib/bsearch.c +++ b/src/lib/libc/stdlib/bsearch.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: bsearch.c,v 1.4 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: bsearch.c,v 1.5 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -50,16 +50,12 @@ static char *rcsid = "$OpenBSD: bsearch.c,v 1.4 2003/06/02 20:18:37 millert Exp * look at item 3. */ void * -bsearch(key, base0, nmemb, size, compar) - register const void *key; - const void *base0; - size_t nmemb; - register size_t size; - register int (*compar)(const void *, const void *); +bsearch(const void *key, const void *base0, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)) { - register const char *base = base0; - register int lim, cmp; - register const void *p; + const char *base = base0; + int lim, cmp; + const void *p; for (lim = nmemb; lim != 0; lim >>= 1) { p = base + (lim >> 1) * size; diff --git a/src/lib/libc/stdlib/calloc.c b/src/lib/libc/stdlib/calloc.c index b0703cc8..7aabed23 100644 --- a/src/lib/libc/stdlib/calloc.c +++ b/src/lib/libc/stdlib/calloc.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: calloc.c,v 1.8 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: calloc.c,v 1.9 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -37,11 +37,9 @@ static char *rcsid = "$OpenBSD: calloc.c,v 1.8 2003/06/02 20:18:37 millert Exp $ #include void * -calloc(num, size) - size_t num; - register size_t size; +calloc(size_t num, size_t size) { - register void *p; + void *p; if (num && size && SIZE_T_MAX / num < size) { errno = ENOMEM; diff --git a/src/lib/libc/stdlib/cfree.c b/src/lib/libc/stdlib/cfree.c index ecbc11d6..db1fa560 100644 --- a/src/lib/libc/stdlib/cfree.c +++ b/src/lib/libc/stdlib/cfree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfree.c,v 1.3 2003/07/18 23:05:13 david Exp $ */ +/* $OpenBSD: cfree.c,v 1.4 2005/03/30 18:51:49 pat Exp $ */ /* * Copyright (c) 1996 SigmaSoft, Th. Lockert @@ -26,7 +26,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: cfree.c,v 1.3 2003/07/18 23:05:13 david Exp $"; +static char rcsid[] = "$OpenBSD: cfree.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -37,8 +37,7 @@ __indr_reference(free, cfree); #else void -cfree(p) - void *p; +cfree(void *p) { free(p); } diff --git a/src/lib/libc/stdlib/div.c b/src/lib/libc/stdlib/div.c index 9e070dcd..32c53dff 100644 --- a/src/lib/libc/stdlib/div.c +++ b/src/lib/libc/stdlib/div.c @@ -31,14 +31,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: div.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: div.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include /* div_t */ div_t -div(num, denom) - int num, denom; +div(int num, int denom) { div_t r; diff --git a/src/lib/libc/stdlib/exit.c b/src/lib/libc/stdlib/exit.c index a75b32ab..a0960e83 100644 --- a/src/lib/libc/stdlib/exit.c +++ b/src/lib/libc/stdlib/exit.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: exit.c,v 1.9 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: exit.c,v 1.10 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -51,11 +51,10 @@ int __isthreaded = 0; * Exit, flushing stdio buffers if necessary. */ void -exit(status) - int status; +exit(int status) { - register struct atexit *p, *q; - register int n, pgsize = getpagesize(); + struct atexit *p, *q; + int n, pgsize = getpagesize(); if (!__atexit_invalid) { p = __atexit; diff --git a/src/lib/libc/stdlib/getenv.c b/src/lib/libc/stdlib/getenv.c index c597e468..7e4d6b91 100644 --- a/src/lib/libc/stdlib/getenv.c +++ b/src/lib/libc/stdlib/getenv.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: getenv.c,v 1.6 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: getenv.c,v 1.7 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -49,9 +49,9 @@ char * __findenv(const char *name, int *offset) { extern char **environ; - register int len, i; - register const char *np; - register char **p, *cp; + int len, i; + const char *np; + char **p, *cp; if (name == NULL || environ == NULL) return (NULL); @@ -75,8 +75,7 @@ __findenv(const char *name, int *offset) * Returns ptr to value associated with name, if any, else NULL. */ char * -getenv(name) - const char *name; +getenv(const char *name) { int offset; diff --git a/src/lib/libc/stdlib/getopt_long.c b/src/lib/libc/stdlib/getopt_long.c index bf50195b..6ddc8e20 100644 --- a/src/lib/libc/stdlib/getopt_long.c +++ b/src/lib/libc/stdlib/getopt_long.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $ */ +/* $OpenBSD: getopt_long.c,v 1.18 2005/03/30 18:51:49 pat Exp $ */ /* $NetBSD: getopt_long.c,v 1.15 2002/01/31 22:43:40 tv Exp $ */ /* @@ -57,7 +57,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: getopt_long.c,v 1.17 2004/06/03 18:46:52 millert Exp $"; +static char *rcsid = "$OpenBSD: getopt_long.c,v 1.18 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -515,12 +515,8 @@ getopt(int nargc, char * const *nargv, const char *options) * Parse argc/argv argument vector. */ int -getopt_long(nargc, nargv, options, long_options, idx) - int nargc; - char * const *nargv; - const char *options; - const struct option *long_options; - int *idx; +getopt_long(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx) { return (getopt_internal(nargc, nargv, options, long_options, idx, @@ -532,12 +528,8 @@ getopt_long(nargc, nargv, options, long_options, idx) * Parse argc/argv argument vector. */ int -getopt_long_only(nargc, nargv, options, long_options, idx) - int nargc; - char * const *nargv; - const char *options; - const struct option *long_options; - int *idx; +getopt_long_only(int nargc, char * const *nargv, const char *options, + const struct option *long_options, int *idx) { return (getopt_internal(nargc, nargv, options, long_options, idx, diff --git a/src/lib/libc/stdlib/getsubopt.c b/src/lib/libc/stdlib/getsubopt.c index 308458ea..dfd7a50b 100644 --- a/src/lib/libc/stdlib/getsubopt.c +++ b/src/lib/libc/stdlib/getsubopt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert Exp $ */ +/* $OpenBSD: getsubopt.c,v 1.3 2005/03/30 18:51:49 pat Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -33,7 +33,7 @@ #if 0 static char sccsid[] = "@(#)getsubopt.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert Exp $"; +static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.3 2005/03/30 18:51:49 pat Exp $"; #endif #endif /* not lint */ @@ -50,12 +50,10 @@ static char rcsid[] = "$OpenBSD: getsubopt.c,v 1.2 2003/06/02 20:18:37 millert E char *suboptarg; int -getsubopt(optionp, tokens, valuep) - register char **optionp, **valuep; - register char * const *tokens; +getsubopt(char **optionp, char * const *tokens, char **valuep) { - register int cnt; - register char *p; + int cnt; + char *p; suboptarg = *valuep = NULL; diff --git a/src/lib/libc/stdlib/heapsort.c b/src/lib/libc/stdlib/heapsort.c index f4aeeef7..dcc0c8ba 100644 --- a/src/lib/libc/stdlib/heapsort.c +++ b/src/lib/libc/stdlib/heapsort.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: heapsort.c,v 1.6 2003/09/08 16:24:05 deraadt Exp $"; +static char *rcsid = "$OpenBSD: heapsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -134,13 +134,11 @@ static char *rcsid = "$OpenBSD: heapsort.c,v 1.6 2003/09/08 16:24:05 deraadt Exp * only advantage over quicksort is that it requires little additional memory. */ int -heapsort(vbase, nmemb, size, compar) - void *vbase; - size_t nmemb, size; - int (*compar)(const void *, const void *); +heapsort(void *vbase, size_t nmemb, size_t size, + int (*compar)(const void *, const void *)) { - register int cnt, i, j, l; - register char tmp, *tmp1, *tmp2; + int cnt, i, j, l; + char tmp, *tmp1, *tmp2; char *base, *k, *p, *t; if (nmemb <= 1) diff --git a/src/lib/libc/stdlib/l64a.c b/src/lib/libc/stdlib/l64a.c index 4e993912..325b41b3 100644 --- a/src/lib/libc/stdlib/l64a.c +++ b/src/lib/libc/stdlib/l64a.c @@ -4,15 +4,14 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: l64a.c,v 1.3 1997/08/17 22:58:34 millert Exp $"; +static char *rcsid = "$OpenBSD: l64a.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include char * -l64a(value) - long value; +l64a(long value) { static char buf[8]; char *s = buf; diff --git a/src/lib/libc/stdlib/labs.c b/src/lib/libc/stdlib/labs.c index 51ef490d..1dc8b018 100644 --- a/src/lib/libc/stdlib/labs.c +++ b/src/lib/libc/stdlib/labs.c @@ -28,14 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: labs.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: labs.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include long -labs(j) - long j; +labs(long j) { return(j < 0 ? -j : j); } diff --git a/src/lib/libc/stdlib/ldiv.c b/src/lib/libc/stdlib/ldiv.c index e005ff77..bbb539a6 100644 --- a/src/lib/libc/stdlib/ldiv.c +++ b/src/lib/libc/stdlib/ldiv.c @@ -31,14 +31,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: ldiv.c,v 1.3 2003/06/02 20:18:37 millert Exp $"; +static char *rcsid = "$OpenBSD: ldiv.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include /* ldiv_t */ ldiv_t -ldiv(num, denom) - long num, denom; +ldiv(long num, long denom) { ldiv_t r; diff --git a/src/lib/libc/stdlib/merge.c b/src/lib/libc/stdlib/merge.c index 1826acc3..b193ae34 100644 --- a/src/lib/libc/stdlib/merge.c +++ b/src/lib/libc/stdlib/merge.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: merge.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: merge.c,v 1.7 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -91,15 +91,12 @@ static void insertionsort(u_char *, size_t, size_t, int (*)()); * Arguments are as for qsort. */ int -mergesort(base, nmemb, size, cmp) - void *base; - size_t nmemb; - register size_t size; - int (*cmp)(const void *, const void *); +mergesort(void *base, size_t nmemb, size_t size, + int (*cmp)(const void *, const void *)) { - register int i, sense; + int i, sense; int big, iflag; - register u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2; + u_char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2; u_char *list2, *list1, *p2, *p, *last, **p1; if (size < PSIZE / 2) { /* Pointers must fit into 2 * size. */ @@ -251,10 +248,8 @@ COPY: b = t; * is defined. Otherwise simple pairwise merging is used.) */ void -setup(list1, list2, n, size, cmp) - size_t n, size; - int (*cmp)(const void *, const void *); - u_char *list1, *list2; +setup(u_char *list1, u_char *list2, size_t n, size_t size, + int (*cmp)(const void *, const void *)) { int i, length, size2, tmp, sense; u_char *f1, *f2, *s, *l2, *last, *p2; @@ -325,10 +320,8 @@ setup(list1, list2, n, size, cmp) * last 4 elements. */ static void -insertionsort(a, n, size, cmp) - u_char *a; - size_t n, size; - int (*cmp)(const void *, const void *); +insertionsort(u_char *a, size_t n, size_t size, + int (*cmp)(const void *, const void *)) { u_char *ai, *s, *t, *u, tmp; int i; diff --git a/src/lib/libc/stdlib/putenv.c b/src/lib/libc/stdlib/putenv.c index 1789e686..231982bf 100644 --- a/src/lib/libc/stdlib/putenv.c +++ b/src/lib/libc/stdlib/putenv.c @@ -28,15 +28,14 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: putenv.c,v 1.3 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: putenv.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include int -putenv(str) - const char *str; +putenv(const char *str) { char *p, *equal; int rval; diff --git a/src/lib/libc/stdlib/qabs.c b/src/lib/libc/stdlib/qabs.c index 296d2d47..4c561b33 100644 --- a/src/lib/libc/stdlib/qabs.c +++ b/src/lib/libc/stdlib/qabs.c @@ -28,14 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: qabs.c,v 1.3 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: qabs.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include quad_t -qabs(j) - quad_t j; +qabs(quad_t j) { return(j < 0 ? -j : j); } diff --git a/src/lib/libc/stdlib/qdiv.c b/src/lib/libc/stdlib/qdiv.c index 6688ccb7..8147ee89 100644 --- a/src/lib/libc/stdlib/qdiv.c +++ b/src/lib/libc/stdlib/qdiv.c @@ -31,14 +31,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: qdiv.c,v 1.3 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: qdiv.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include /* qdiv_t */ qdiv_t -qdiv(num, denom) - quad_t num, denom; +qdiv(quad_t num, quad_t denom) { qdiv_t r; diff --git a/src/lib/libc/stdlib/qsort.c b/src/lib/libc/stdlib/qsort.c index 2a972c0e..154c51a8 100644 --- a/src/lib/libc/stdlib/qsort.c +++ b/src/lib/libc/stdlib/qsort.c @@ -28,13 +28,13 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: qsort.c,v 1.8 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: qsort.c,v 1.9 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include #include -static __inline char *med3(char *, char *, char *, int (*)()); +static __inline char *med3(char *, char *, char *, int (*)(const void *, const void *)); static __inline void swapfunc(char *, char *, int, int); #define min(a, b) (a) < (b) ? a : b @@ -44,10 +44,10 @@ static __inline void swapfunc(char *, char *, int, int); */ #define swapcode(TYPE, parmi, parmj, n) { \ long i = (n) / sizeof (TYPE); \ - register TYPE *pi = (TYPE *) (parmi); \ - register TYPE *pj = (TYPE *) (parmj); \ + TYPE *pi = (TYPE *) (parmi); \ + TYPE *pj = (TYPE *) (parmj); \ do { \ - register TYPE t = *pi; \ + TYPE t = *pi; \ *pi++ = *pj; \ *pj++ = t; \ } while (--i > 0); \ @@ -57,9 +57,7 @@ static __inline void swapfunc(char *, char *, int, int); es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; static __inline void -swapfunc(a, b, n, swaptype) - char *a, *b; - int n, swaptype; +swapfunc(char *a, char *b, int n, int swaptype) { if (swaptype <= 1) swapcode(long, a, b, n) @@ -78,9 +76,7 @@ swapfunc(a, b, n, swaptype) #define vecswap(a, b, n) if ((n) > 0) swapfunc(a, b, n, swaptype) static __inline char * -med3(a, b, c, cmp) - char *a, *b, *c; - int (*cmp)(); +med3(char *a, char *b, char *c, int (*cmp)(const void *, const void *)) { return cmp(a, b) < 0 ? (cmp(b, c) < 0 ? b : (cmp(a, c) < 0 ? c : a )) @@ -88,14 +84,11 @@ med3(a, b, c, cmp) } void -qsort(aa, n, es, cmp) - void *aa; - size_t n, es; - int (*cmp)(); +qsort(void *aa, size_t n, size_t es, int (*cmp)(const void *, const void *)) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; int d, r, swaptype, swap_cnt; - register char *a = aa; + char *a = aa; loop: SWAPINIT(a, es); swap_cnt = 0; diff --git a/src/lib/libc/stdlib/radixsort.c b/src/lib/libc/stdlib/radixsort.c index 1ff30416..96392ea7 100644 --- a/src/lib/libc/stdlib/radixsort.c +++ b/src/lib/libc/stdlib/radixsort.c @@ -31,7 +31,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: radixsort.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: radixsort.c,v 1.7 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ /* @@ -85,10 +85,7 @@ static void r_sort_b(const u_char **, } int -radixsort(a, n, tab, endch) - const u_char **a, *tab; - int n; - u_int endch; +radixsort(const u_char **a, int n, const u_char *tab, u_int endch) { const u_char *tr; int c; @@ -100,10 +97,7 @@ radixsort(a, n, tab, endch) } int -sradixsort(a, n, tab, endch) - const u_char **a, *tab; - int n; - u_int endch; +sradixsort(const u_char **a, int n, const u_char *tab, u_int endch) { const u_char *tr, **ta; int c; @@ -128,15 +122,11 @@ sradixsort(a, n, tab, endch) /* Unstable, in-place sort. */ void -r_sort_a(a, n, i, tr, endch) - const u_char **a; - int n, i; - const u_char *tr; - u_int endch; +r_sort_a(const u_char **a, int n, int i, const u_char *tr, u_int endch) { static int count[256], nc, bmin; - register int c; - register const u_char **ak, *r; + int c; + const u_char **ak, *r; stack s[SIZE], *sp, *sp0, *sp1, temp; int *cp, bigc; const u_char **an, *t, **aj, **top[256]; @@ -219,15 +209,12 @@ r_sort_a(a, n, i, tr, endch) /* Stable sort, requiring additional memory. */ void -r_sort_b(a, ta, n, i, tr, endch) - const u_char **a, **ta; - int n, i; - const u_char *tr; - u_int endch; +r_sort_b(const u_char **a, const u_char **ta, int n, int i, const u_char *tr, + u_int endch) { static int count[256], nc, bmin; - register int c; - register const u_char **ak, **ai; + int c; + const u_char **ak, **ai; stack s[512], *sp, *sp0, *sp1, temp; const u_char **top[256]; int *cp, bigc; @@ -291,13 +278,10 @@ r_sort_b(a, ta, n, i, tr, endch) } static __inline void -simplesort(a, n, b, tr, endch) /* insertion sort */ - register const u_char **a; - int n, b; - register const u_char *tr; - u_int endch; +simplesort(const u_char **a, int n, int b, const u_char *tr, u_int endch) + /* insertion sort */ { - register u_char ch; + u_char ch; const u_char **ak, **ai, *s, *t; for (ak = a+1; --n >= 1; ak++) diff --git a/src/lib/libc/stdlib/rand.c b/src/lib/libc/stdlib/rand.c index d58d040a..6b27ad46 100644 --- a/src/lib/libc/stdlib/rand.c +++ b/src/lib/libc/stdlib/rand.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: rand.c,v 1.8 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -37,25 +37,20 @@ static char *rcsid = "$OpenBSD: rand.c,v 1.7 2003/06/02 20:18:38 millert Exp $"; static u_int next = 1; int -rand_r(seed) -u_int *seed; +rand_r(u_int *seed) { - *seed = *seed * 1103515245 + 12345; return (*seed % ((u_int)RAND_MAX + 1)); } int -rand() +rand(void) { - return (rand_r(&next)); } void -srand(seed) -u_int seed; +srand(u_int seed) { - next = seed; } diff --git a/src/lib/libc/stdlib/random.c b/src/lib/libc/stdlib/random.c index 4807d2f2..4ca8735e 100644 --- a/src/lib/libc/stdlib/random.c +++ b/src/lib/libc/stdlib/random.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: random.c,v 1.12 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: random.c,v 1.13 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -190,8 +190,7 @@ static int rand_sep = SEP_3; * for default usage relies on values produced by this routine. */ void -srandom(x) - unsigned int x; +srandom(unsigned int x) { int i; int32_t test; @@ -232,7 +231,7 @@ srandom(x) * a fixed seed. */ void -srandomdev() +srandomdev(void) { int fd, i, mib[2], n; size_t len; @@ -299,10 +298,7 @@ srandomdev() * Returns a pointer to the old state. */ char * -initstate(seed, arg_state, n) - u_int seed; /* seed for R.N.G. */ - char *arg_state; /* pointer to state array */ - size_t n; /* # bytes of state info */ +initstate(u_int seed, char *arg_state, size_t n) { char *ostate = (char *)(&state[-1]); @@ -359,8 +355,7 @@ initstate(seed, arg_state, n) * Returns a pointer to the old state information. */ char * -setstate(arg_state) - const char *arg_state; +setstate(const char *arg_state) { int32_t *new_state = (int32_t *)arg_state; int32_t type = new_state[0] % MAX_TYPES; @@ -411,7 +406,7 @@ setstate(arg_state) * Returns a 31-bit random number. */ long -random() +random(void) { int32_t i; diff --git a/src/lib/libc/stdlib/setenv.c b/src/lib/libc/stdlib/setenv.c index 40305dbe..ce0d3f96 100644 --- a/src/lib/libc/stdlib/setenv.c +++ b/src/lib/libc/stdlib/setenv.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: setenv.c,v 1.7 2005/02/16 21:20:22 millert Exp $"; +static char *rcsid = "$OpenBSD: setenv.c,v 1.8 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -44,10 +44,7 @@ extern char **environ; * "value". If rewrite is set, replace any current value. */ int -setenv(name, value, rewrite) - const char *name; - const char *value; - int rewrite; +setenv(const char *name, const char *value, int rewrite) { static char **lastenv; /* last value of environ */ char *C; @@ -97,8 +94,7 @@ setenv(name, value, rewrite) * Delete environmental variable "name". */ void -unsetenv(name) - const char *name; +unsetenv(const char *name) { char **P; int offset; diff --git a/src/lib/libc/stdlib/strtod.c b/src/lib/libc/stdlib/strtod.c index 8e839d61..94eca886 100644 --- a/src/lib/libc/stdlib/strtod.c +++ b/src/lib/libc/stdlib/strtod.c @@ -79,7 +79,6 @@ * #define Just_16 to store 16 bits per 32-bit Long when doing high-precision * integer arithmetic. Whether this speeds things up or slows things * down depends on the machine and the number being converted. - * #define KR_headers for old-style C function headers. * #define Bad_float_h if your system lacks a float.h or if it does not * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. @@ -90,7 +89,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strtod.c,v 1.19 2004/02/03 16:52:11 drahn Exp $"; +static char *rcsid = "$OpenBSD: strtod.c,v 1.20 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ @@ -130,22 +129,13 @@ static char *rcsid = "$OpenBSD: strtod.c,v 1.19 2004/02/03 16:52:11 drahn Exp $" #include "malloc.h" #include "memory.h" #else -#ifndef KR_headers #include "stdlib.h" #include "string.h" #include "locale.h" -#else -#include "malloc.h" -#include "memory.h" -#endif #endif #ifdef MALLOC -#ifdef KR_headers -extern char *MALLOC(); -#else extern void *MALLOC(size_t); -#endif #else #define MALLOC malloc #endif @@ -203,12 +193,8 @@ extern "C" { #endif #ifndef CONST -#ifdef KR_headers -#define CONST /* blank */ -#else #define CONST const #endif -#endif #ifdef Unsigned_Shifts #define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; @@ -341,11 +327,7 @@ typedef union { #ifdef RND_PRODQUOT #define rounded_product(a,b) a = rnd_prod(a, b) #define rounded_quotient(a,b) a = rnd_quot(a, b) -#ifdef KR_headers -extern double rnd_prod(), rnd_quot(); -#else extern double rnd_prod(double, double), rnd_quot(double, double); -#endif #else #define rounded_product(a,b) a *= b #define rounded_quotient(a,b) a /= b @@ -385,12 +367,7 @@ Bigint { static Bigint *freelist[Kmax+1]; static Bigint * -Balloc -#ifdef KR_headers - (k) int k; -#else - (int k) -#endif +Balloc(int k) { int x; Bigint *rv; @@ -409,12 +386,7 @@ Balloc } static void -Bfree -#ifdef KR_headers - (v) Bigint *v; -#else - (Bigint *v) -#endif +Bfree(Bigint *v) { if (v) { v->next = freelist[v->k]; @@ -426,12 +398,7 @@ Bfree y->wds*sizeof(Long) + 2*sizeof(int)) static Bigint * -multadd -#ifdef KR_headers - (b, m, a) Bigint *b; int m, a; -#else - (Bigint *b, int m, int a) /* multiply by m and add a */ -#endif +multadd(Bigint *b, int m, int a) /* multiply by m and add a */ { int i, wds; ULong *x, y; @@ -471,12 +438,7 @@ multadd } static Bigint * -s2b -#ifdef KR_headers - (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9; -#else - (CONST char *s, int nd0, int nd, ULong y9) -#endif +s2b(CONST char *s, int nd0, int nd, ULong y9) { Bigint *b; int i, k; @@ -509,14 +471,9 @@ s2b } static int -hi0bits -#ifdef KR_headers - (x) register ULong x; -#else - (register ULong x) -#endif +hi0bits(ULong x) { - register int k = 0; + int k = 0; if (!(x & 0xffff0000)) { k = 16; @@ -543,15 +500,10 @@ hi0bits } static int -lo0bits -#ifdef KR_headers - (y) ULong *y; -#else - (ULong *y) -#endif +lo0bits(ULong *y) { - register int k; - register ULong x = *y; + int k; + ULong x = *y; if (x & 7) { if (x & 1) @@ -591,12 +543,7 @@ lo0bits } static Bigint * -i2b -#ifdef KR_headers - (i) int i; -#else - (int i) -#endif +i2b(int i) { Bigint *b; @@ -607,12 +554,7 @@ i2b } static Bigint * -mult -#ifdef KR_headers - (a, b) Bigint *a, *b; -#else - (Bigint *a, Bigint *b) -#endif +mult(Bigint *a, Bigint *b) { Bigint *c; int k, wa, wb, wc; @@ -697,12 +639,7 @@ mult static Bigint *p5s; static Bigint * -pow5mult -#ifdef KR_headers - (b, k) Bigint *b; int k; -#else - (Bigint *b, int k) -#endif +pow5mult(Bigint *b, int k) { Bigint *b1, *p5, *p51; int i; @@ -736,12 +673,7 @@ pow5mult } static Bigint * -lshift -#ifdef KR_headers - (b, k) Bigint *b; int k; -#else - (Bigint *b, int k) -#endif +lshift(Bigint *b, int k) { int i, k1, n, n1; Bigint *b1; @@ -796,12 +728,7 @@ lshift } static int -cmp -#ifdef KR_headers - (a, b) Bigint *a, *b; -#else - (Bigint *a, Bigint *b) -#endif +cmp(Bigint *a, Bigint *b) { ULong *xa, *xa0, *xb, *xb0; int i, j; @@ -830,12 +757,7 @@ cmp } static Bigint * -diff -#ifdef KR_headers - (a, b) Bigint *a, *b; -#else - (Bigint *a, Bigint *b) -#endif +diff(Bigint *a, Bigint *b) { Bigint *c; int i, wa, wb; @@ -912,15 +834,10 @@ diff } static double -ulp -#ifdef KR_headers - (_x) double _x; -#else - (double _x) -#endif +ulp(double _x) { _double x; - register Long L; + Long L; _double a; value(x) = _x; @@ -952,12 +869,7 @@ ulp } static double -b2d -#ifdef KR_headers - (a, e) Bigint *a; int *e; -#else - (Bigint *a, int *e) -#endif +b2d(Bigint *a, int *e) { ULong *xa, *xa0, w, y, z; int k; @@ -1022,12 +934,7 @@ b2d } static Bigint * -d2b -#ifdef KR_headers - (_d, e, bits) double d; int *e, *bits; -#else - (double _d, int *e, int *bits) -#endif +d2b(double _d, int *e, int *bits) { Bigint *b; int de, i, k; @@ -1156,12 +1063,7 @@ d2b #undef d1 static double -ratio -#ifdef KR_headers - (a, b) Bigint *a, *b; -#else - (Bigint *a, Bigint *b) -#endif +ratio(Bigint *a, Bigint *b) { _double da, db; int k, ka, kb; @@ -1223,12 +1125,7 @@ static CONST double tinytens[] = { 1e-16, 1e-32 }; #endif double -strtod -#ifdef KR_headers - (s00, se) CONST char *s00; char **se; -#else - (CONST char *s00, char **se) -#endif +strtod(CONST char *s00, char **se) { int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; @@ -1239,11 +1136,7 @@ strtod ULong y, z; Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; -#ifndef KR_headers CONST char decimal_point = localeconv()->decimal_point[0]; -#else - CONST char decimal_point = '.'; -#endif sign = nz0 = nz = 0; value(rv) = 0.; @@ -1769,12 +1662,7 @@ strtod } static int -quorem -#ifdef KR_headers - (b, S) Bigint *b, *S; -#else - (Bigint *b, Bigint *S) -#endif +quorem(Bigint *b, Bigint *S) { int n; Long borrow, y; @@ -1909,13 +1797,7 @@ quorem */ char * -__dtoa -#ifdef KR_headers - (_d, mode, ndigits, decpt, sign, rve) - double _d; int mode, ndigits, *decpt, *sign; char **rve; -#else - (double _d, int mode, int ndigits, int *decpt, int *sign, char **rve) -#endif +__dtoa(double _d, int mode, int ndigits, int *decpt, int *sign, char **rve) { /* Arguments ndigits, decpt, sign are similar to those of ecvt and fcvt; trailing zeros are suppressed from diff --git a/src/lib/libc/stdlib/strtol.c b/src/lib/libc/stdlib/strtol.c index 1c397207..9692bb6b 100644 --- a/src/lib/libc/stdlib/strtol.c +++ b/src/lib/libc/stdlib/strtol.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strtol.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: strtol.c,v 1.6 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -44,15 +44,12 @@ static char *rcsid = "$OpenBSD: strtol.c,v 1.5 2003/06/02 20:18:38 millert Exp $ * alphabets and digits are each contiguous. */ long -strtol(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtol(const char *nptr, char **endptr, int base) { - register const char *s; - register long acc, cutoff; - register int c; - register int neg, any, cutlim; + const char *s; + long acc, cutoff; + int c; + int neg, any, cutlim; /* * Skip white space and pick up leading +/- sign if any. diff --git a/src/lib/libc/stdlib/strtoll.c b/src/lib/libc/stdlib/strtoll.c index 5002e9ed..fa4d30ef 100644 --- a/src/lib/libc/stdlib/strtoll.c +++ b/src/lib/libc/stdlib/strtoll.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.3 2005/03/02 12:24:26 millert Exp $"; +static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,10 +45,7 @@ static const char rcsid[] = "$OpenBSD: strtoll.c,v 1.3 2005/03/02 12:24:26 mille * alphabets and digits are each contiguous. */ long long -strtoll(nptr, endptr, base) - const char *nptr; - char **endptr; - int base; +strtoll(const char *nptr, char **endptr, int base) { const char *s; long long acc, cutoff; @@ -151,10 +148,7 @@ strtoll(nptr, endptr, base) __weak_alias(strtoq, strtoll); #else quad_t -strtoq(nptr, endptr, base) - const char *nptr; - char **endptr; - int base; +strtoq(const char *nptr, char **endptr, int base) { return ((quad_t)strtoll(nptr, endptr, base)); diff --git a/src/lib/libc/stdlib/strtoul.c b/src/lib/libc/stdlib/strtoul.c index 7d31ce79..1faa0abb 100644 --- a/src/lib/libc/stdlib/strtoul.c +++ b/src/lib/libc/stdlib/strtoul.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strtoul.c,v 1.5 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: strtoul.c,v 1.6 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -43,15 +43,12 @@ static char *rcsid = "$OpenBSD: strtoul.c,v 1.5 2003/06/02 20:18:38 millert Exp * alphabets and digits are each contiguous. */ unsigned long -strtoul(nptr, endptr, base) - const char *nptr; - char **endptr; - register int base; +strtoul(const char *nptr, char **endptr, int base) { - register const char *s; - register unsigned long acc, cutoff; - register int c; - register int neg, any, cutlim; + const char *s; + unsigned long acc, cutoff; + int c; + int neg, any, cutlim; /* * See strtol for comments as to the logic used. diff --git a/src/lib/libc/stdlib/strtoull.c b/src/lib/libc/stdlib/strtoull.c index c383f1d8..5fa841ff 100644 --- a/src/lib/libc/stdlib/strtoull.c +++ b/src/lib/libc/stdlib/strtoull.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.3 2005/03/02 12:24:26 millert Exp $"; +static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.4 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -45,10 +45,7 @@ static const char rcsid[] = "$OpenBSD: strtoull.c,v 1.3 2005/03/02 12:24:26 mill * alphabets and digits are each contiguous. */ unsigned long long -strtoull(nptr, endptr, base) - const char *nptr; - char **endptr; - int base; +strtoull(const char *nptr, char **endptr, int base) { const char *s; unsigned long long acc, cutoff; @@ -113,10 +110,7 @@ strtoull(nptr, endptr, base) __weak_alias(strtouq, strtoull); #else u_quad_t -strtouq(nptr, endptr, base) - const char *nptr; - char **endptr; - int base; +strtouq(const char *nptr, char **endptr, int base) { return ((u_quad_t)strtoull(nptr, endptr, base)); diff --git a/src/lib/libc/stdlib/system.c b/src/lib/libc/stdlib/system.c index 06b43923..ebf55776 100644 --- a/src/lib/libc/stdlib/system.c +++ b/src/lib/libc/stdlib/system.c @@ -28,7 +28,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: system.c,v 1.6 2003/06/02 20:18:38 millert Exp $"; +static char *rcsid = "$OpenBSD: system.c,v 1.7 2005/03/30 18:51:49 pat Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -41,8 +41,7 @@ static char *rcsid = "$OpenBSD: system.c,v 1.6 2003/06/02 20:18:38 millert Exp $ extern char **environ; int -system(command) - const char *command; +system(const char *command) { pid_t pid; sig_t intsave, quitsave; diff --git a/src/lib/libc/stdlib/tfind.c b/src/lib/libc/stdlib/tfind.c index 34b916db..ff6bcd74 100644 --- a/src/lib/libc/stdlib/tfind.c +++ b/src/lib/libc/stdlib/tfind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tfind.c,v 1.4 2004/10/01 04:08:45 jsg Exp $ */ +/* $OpenBSD: tfind.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -21,10 +21,8 @@ typedef struct node_t /* find a node, or return 0 */ void * -tfind(vkey, vrootp, compar) - const void *vkey; /* key to be found */ - void *const *vrootp; /* address of the tree root */ - int (*compar)(const void *, const void *); +tfind(const void *vkey, void * const *vrootp, + int (*compar)(const void *, const void *)) { char *key = (char *)vkey; node **rootp = (node **)vrootp; diff --git a/src/lib/libc/stdlib/tsearch.c b/src/lib/libc/stdlib/tsearch.c index 67388b4e..a5d0c2b9 100644 --- a/src/lib/libc/stdlib/tsearch.c +++ b/src/lib/libc/stdlib/tsearch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsearch.c,v 1.4 2004/10/01 04:08:45 jsg Exp $ */ +/* $OpenBSD: tsearch.c,v 1.5 2005/03/30 18:51:49 pat Exp $ */ /* * Tree search generalized from Knuth (6.2.2) Algorithm T just like @@ -22,12 +22,10 @@ typedef struct node_t { /* find or insert datum into search tree */ void * -tsearch(vkey, vrootp, compar) - const void *vkey; /* key to be located */ - void **vrootp; /* address of tree root */ - int (*compar)(const void *, const void *); +tsearch(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) { - register node *q; + node *q; char *key = (char *)vkey; node **rootp = (node **)vrootp; @@ -53,16 +51,14 @@ tsearch(vkey, vrootp, compar) /* delete node with given key */ void * -tdelete(vkey, vrootp, compar) - const void *vkey; /* key to be deleted */ - void **vrootp; /* address of the root of tree */ - int (*compar)(const void *, const void *); +tdelete(const void *vkey, void **vrootp, + int (*compar)(const void *, const void *)) { node **rootp = (node **)vrootp; char *key = (char *)vkey; node *p; - register node *q; - register node *r; + node *q; + node *r; int cmp; if (rootp == (struct node_t **)0 || (p = *rootp) == (struct node_t *)0) @@ -97,10 +93,7 @@ tdelete(vkey, vrootp, compar) /* Walk the nodes of a tree */ static void -trecurse(root, action, level) - register node *root; /* Root of the tree to be walked */ - register void (*action)(); /* Function to be called at each node */ - register int level; +trecurse(node *root, void (*action)(const void *, VISIT, int), int level) { if (root->left == (struct node_t *)0 && root->right == (struct node_t *)0) (*action)(root, leaf, level); @@ -117,12 +110,10 @@ trecurse(root, action, level) /* Walk the nodes of a tree */ void -twalk(vroot, action) - const void *vroot; /* Root of the tree to be walked */ - void (*action)(const void *, VISIT, int); +twalk(const void *vroot, void (*action)(const void *, VISIT, int)) { node *root = (node *)vroot; - if (root != (node *)0 && action != (void(*)())0) + if (root != (node *)0 && action != (void (*)(const void *, VISIT, int))0) trecurse(root, action, 0); }