From 4a8dea8cf97aab33f4e6a11afcc64dd9562f3bfd Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Sun, 19 Nov 2017 00:31:13 +0000 Subject: [PATCH] ANSIfy sys/libkern PR: 223641 Submitted by: ota@j.email.ne.jp MFC after: 1 week --- sys/libkern/ashrdi3.c | 4 +--- sys/libkern/bcmp.c | 4 +--- sys/libkern/bsearch.c | 8 ++------ sys/libkern/cmpdi2.c | 3 +-- sys/libkern/divdi3.c | 3 +-- sys/libkern/lshrdi3.c | 4 +--- sys/libkern/mcount.c | 6 ++---- sys/libkern/moddi3.c | 3 +-- sys/libkern/qdivrem.c | 3 +-- sys/libkern/random.c | 3 +-- sys/libkern/scanc.c | 5 +---- sys/libkern/strcmp.c | 3 +-- sys/libkern/strlcat.c | 5 +---- sys/libkern/strsep.c | 4 +--- sys/libkern/strtol.c | 5 +---- sys/libkern/strtoul.c | 5 +---- sys/libkern/ucmpdi2.c | 3 +-- sys/libkern/udivdi3.c | 3 +-- sys/libkern/umoddi3.c | 3 +-- 19 files changed, 21 insertions(+), 56 deletions(-) diff --git a/sys/libkern/ashrdi3.c b/sys/libkern/ashrdi3.c index bba4897b2b8c..df3d569b071f 100644 --- a/sys/libkern/ashrdi3.c +++ b/sys/libkern/ashrdi3.c @@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$"); * Shift a (signed) quad value right (arithmetic shift right). */ quad_t -__ashrdi3(a, shift) - quad_t a; - qshift_t shift; +__ashrdi3(quad_t a, qshift_t shift) { union uu aa; diff --git a/sys/libkern/bcmp.c b/sys/libkern/bcmp.c index 37cce24956fe..023d4cbe3cbf 100644 --- a/sys/libkern/bcmp.c +++ b/sys/libkern/bcmp.c @@ -42,9 +42,7 @@ typedef const unsigned long *culp; * bcmp -- vax cmpc3 instruction */ int -bcmp(b1, b2, length) - const void *b1, *b2; - size_t length; +bcmp(const void *b1, const void *b2, size_t length) { #if BYTE_ORDER == LITTLE_ENDIAN /* diff --git a/sys/libkern/bsearch.c b/sys/libkern/bsearch.c index 689f6203051b..37bf6fff50bf 100644 --- a/sys/libkern/bsearch.c +++ b/sys/libkern/bsearch.c @@ -53,12 +53,8 @@ __FBSDID("$FreeBSD$"); * look at item 3. */ void * -bsearch(key, base0, nmemb, size, compar) - const void *key; - const void *base0; - size_t nmemb; - size_t size; - 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 *)) { const char *base = base0; size_t lim; diff --git a/sys/libkern/cmpdi2.c b/sys/libkern/cmpdi2.c index ae077e9514bb..d0b44a896fb8 100644 --- a/sys/libkern/cmpdi2.c +++ b/sys/libkern/cmpdi2.c @@ -42,8 +42,7 @@ __FBSDID("$FreeBSD$"); * signed. */ int -__cmpdi2(a, b) - quad_t a, b; +__cmpdi2(quad_t a, quad_t b) { union uu aa, bb; diff --git a/sys/libkern/divdi3.c b/sys/libkern/divdi3.c index e080b290164c..499e0b78a7dc 100644 --- a/sys/libkern/divdi3.c +++ b/sys/libkern/divdi3.c @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); * ??? if -1/2 should produce -1 on this machine, this code is wrong */ quad_t -__divdi3(a, b) - quad_t a, b; +__divdi3(quad_t a, quad_t b) { u_quad_t ua, ub, uq; int neg; diff --git a/sys/libkern/lshrdi3.c b/sys/libkern/lshrdi3.c index df8f5e852dc9..ec87e07cf564 100644 --- a/sys/libkern/lshrdi3.c +++ b/sys/libkern/lshrdi3.c @@ -40,9 +40,7 @@ __FBSDID("$FreeBSD$"); * Shift an (unsigned) quad value right (logical shift right). */ quad_t -__lshrdi3(a, shift) - quad_t a; - qshift_t shift; +__lshrdi3(quad_t a, qshift_t shift) { union uu aa; diff --git a/sys/libkern/mcount.c b/sys/libkern/mcount.c index a0768c1ea274..f180967a7206 100644 --- a/sys/libkern/mcount.c +++ b/sys/libkern/mcount.c @@ -56,8 +56,7 @@ __FBSDID("$FreeBSD$"); * both frompcindex and frompc. Any reasonable, modern compiler will * perform this optimization. */ -_MCOUNT_DECL(frompc, selfpc) /* _mcount; may be static, inline, etc */ - uintfptr_t frompc, selfpc; +_MCOUNT_DECL(uintfptr_t frompc, uintfptr_t selfpc) /* _mcount; may be static, inline, etc */ { #ifdef GUPROF int delta; @@ -245,8 +244,7 @@ MCOUNT #ifdef GUPROF void -mexitcount(selfpc) - uintfptr_t selfpc; +mexitcount(uintfptr_t selfpc) { struct gmonparam *p; uintfptr_t selfpcdiff; diff --git a/sys/libkern/moddi3.c b/sys/libkern/moddi3.c index ad0e5dda15ad..5564b9c24a2d 100644 --- a/sys/libkern/moddi3.c +++ b/sys/libkern/moddi3.c @@ -43,8 +43,7 @@ __FBSDID("$FreeBSD$"); * If -1/2 should produce -1 on this machine, this code is wrong. */ quad_t -__moddi3(a, b) - quad_t a, b; +__moddi3(quad_t a, quad_t b) { u_quad_t ua, ub, ur; int neg; diff --git a/sys/libkern/qdivrem.c b/sys/libkern/qdivrem.c index 7f95ea195cd1..336a4b53e135 100644 --- a/sys/libkern/qdivrem.c +++ b/sys/libkern/qdivrem.c @@ -77,8 +77,7 @@ __shl(digit *p, int len, int sh) * leading zeros). */ u_quad_t -__qdivrem(uq, vq, arq) - u_quad_t uq, vq, *arq; +__qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq) { union uu tmp; digit *u, *v, *q; diff --git a/sys/libkern/random.c b/sys/libkern/random.c index 85bd3677baa8..e580b7130890 100644 --- a/sys/libkern/random.c +++ b/sys/libkern/random.c @@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$"); static u_long randseed = 937186357; /* after srandom(1), NSHUFF counted */ void -srandom(seed) - u_long seed; +srandom(u_long seed) { int i; diff --git a/sys/libkern/scanc.c b/sys/libkern/scanc.c index e27522982bd5..4531faa81cd8 100644 --- a/sys/libkern/scanc.c +++ b/sys/libkern/scanc.c @@ -35,10 +35,7 @@ __FBSDID("$FreeBSD$"); #include int -scanc(size, cp, table, mask0) - u_int size; - const u_char *cp, table[]; - int mask0; +scanc(u_int size, const u_char *cp, const u_char table[], int mask0) { const u_char *end; u_char mask; diff --git a/sys/libkern/strcmp.c b/sys/libkern/strcmp.c index 8b80027a35b1..fcfdde8fface 100644 --- a/sys/libkern/strcmp.c +++ b/sys/libkern/strcmp.c @@ -39,8 +39,7 @@ __FBSDID("$FreeBSD$"); * Compare strings. */ int -strcmp(s1, s2) - const char *s1, *s2; +strcmp(const char *s1, const char *s2) { while (*s1 == *s2++) if (*s1++ == 0) diff --git a/sys/libkern/strlcat.c b/sys/libkern/strlcat.c index 74d3bcc87d54..c532ffcdbe99 100644 --- a/sys/libkern/strlcat.c +++ b/sys/libkern/strlcat.c @@ -44,10 +44,7 @@ __FBSDID("$FreeBSD$"); * If retval >= siz, truncation occurred. */ size_t -strlcat(dst, src, siz) - char *dst; - const char *src; - size_t siz; +strlcat(char *dst, const char *src, size_t siz) { char *d = dst; const char *s = src; diff --git a/sys/libkern/strsep.c b/sys/libkern/strsep.c index 31a86a42349e..bf74112da63c 100644 --- a/sys/libkern/strsep.c +++ b/sys/libkern/strsep.c @@ -48,9 +48,7 @@ __FBSDID("$FreeBSD$"); * If *stringp is NULL, strsep returns NULL. */ char * -strsep(stringp, delim) - char **stringp; - const char *delim; +strsep(char **stringp, const char *delim) { char *s; const char *spanp; diff --git a/sys/libkern/strtol.c b/sys/libkern/strtol.c index b1a5c01cd59b..739cccbff492 100644 --- a/sys/libkern/strtol.c +++ b/sys/libkern/strtol.c @@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$"); * alphabets and digits are each contiguous. */ long -strtol(nptr, endptr, base) - const char *nptr; - char **endptr; - int base; +strtol(const char *nptr, char **endptr, int base) { const char *s = nptr; unsigned long acc; diff --git a/sys/libkern/strtoul.c b/sys/libkern/strtoul.c index 746ac923bd09..7b24e2272270 100644 --- a/sys/libkern/strtoul.c +++ b/sys/libkern/strtoul.c @@ -47,10 +47,7 @@ __FBSDID("$FreeBSD$"); * alphabets and digits are each contiguous. */ unsigned long -strtoul(nptr, endptr, base) - const char *nptr; - char **endptr; - int base; +strtoul(const char *nptr, char **endptr, int base) { const char *s = nptr; unsigned long acc; diff --git a/sys/libkern/ucmpdi2.c b/sys/libkern/ucmpdi2.c index fe0d8f5e4d40..91c3c5a3556d 100644 --- a/sys/libkern/ucmpdi2.c +++ b/sys/libkern/ucmpdi2.c @@ -41,8 +41,7 @@ __FBSDID("$FreeBSD$"); * Neither a nor b are considered signed. */ int -__ucmpdi2(a, b) - u_quad_t a, b; +__ucmpdi2(u_quad_t a, u_quad_t b) { union uu aa, bb; diff --git a/sys/libkern/udivdi3.c b/sys/libkern/udivdi3.c index 9bf7542b878c..2d00ea6c5a13 100644 --- a/sys/libkern/udivdi3.c +++ b/sys/libkern/udivdi3.c @@ -40,8 +40,7 @@ __FBSDID("$FreeBSD$"); * Divide two unsigned quads. */ u_quad_t -__udivdi3(a, b) - u_quad_t a, b; +__udivdi3(u_quad_t a, u_quad_t b) { return (__qdivrem(a, b, (u_quad_t *)0)); diff --git a/sys/libkern/umoddi3.c b/sys/libkern/umoddi3.c index 9b2111196e66..2f5c540dc6b1 100644 --- a/sys/libkern/umoddi3.c +++ b/sys/libkern/umoddi3.c @@ -40,8 +40,7 @@ __FBSDID("$FreeBSD$"); * Return remainder after dividing two unsigned quads. */ u_quad_t -__umoddi3(a, b) - u_quad_t a, b; +__umoddi3(u_quad_t a, u_quad_t b) { u_quad_t r;