From 0be1f7d80eff8e3e86b037958be3ab5217ce9b59 Mon Sep 17 00:00:00 2001 From: millert <> Date: Tue, 19 Feb 2002 19:39:38 +0000 Subject: We live in an ANSI C world. Remove lots of gratuitous #ifdef __STDC__ cruft. --- src/lib/libc/crypt/bcrypt.c | 33 +-------------- src/lib/libc/crypt/blowfish.c | 86 +--------------------------------------- src/lib/libc/net/htons.c | 7 +--- src/lib/libc/net/ntohs.c | 7 +--- src/lib/libc/net/res_comp.c | 12 ++---- src/lib/libc/net/res_random.c | 8 +--- src/lib/libc/stdlib/multibyte.c | 8 +--- src/lib/libc/stdlib/strtod.c | 5 +-- src/regress/lib/libc/db/dbtest.c | 22 ++-------- 9 files changed, 15 insertions(+), 173 deletions(-) (limited to 'src') diff --git a/src/lib/libc/crypt/bcrypt.c b/src/lib/libc/crypt/bcrypt.c index f3ea849f00..dec0093dd8 100644 --- a/src/lib/libc/crypt/bcrypt.c +++ b/src/lib/libc/crypt/bcrypt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcrypt.c,v 1.15 2002/02/16 21:27:21 millert Exp $ */ +/* $OpenBSD: bcrypt.c,v 1.16 2002/02/19 19:39:36 millert Exp $ */ /* * Copyright 1997 Niels Provos @@ -97,16 +97,8 @@ const static u_int8_t index_64[128] = }; #define CHAR64(c) ( (c) > 127 ? 255 : index_64[(c)]) -#ifdef __STDC__ static void decode_base64(u_int8_t *buffer, u_int16_t len, u_int8_t *data) -#else -static void -decode_base64(buffer, len, data) - u_int8_t *buffer; - u_int16_t len; - u_int8_t *data; -#endif { u_int8_t *bp = buffer; u_int8_t *p = data; @@ -140,17 +132,8 @@ decode_base64(buffer, len, data) } } -#ifdef __STDC__ static void encode_salt(char *salt, u_int8_t *csalt, u_int16_t clen, u_int8_t logr) -#else -static void -encode_salt(salt, csalt, clen, logr) - char *salt; - u_int8_t *csalt; - u_int16_t clen; - u_int8_t logr; -#endif { salt[0] = '$'; salt[1] = BCRYPT_VERSION; @@ -166,14 +149,8 @@ encode_salt(salt, csalt, clen, logr) seems sensible. */ -#ifdef __STDC__ char * bcrypt_gensalt(u_int8_t log_rounds) -#else -char * -bcrypt_gensalt(log_rounds) - u_int8_t log_rounds; -#endif { u_int8_t csalt[BCRYPT_MAXSALT]; u_int16_t i; @@ -296,16 +273,8 @@ bcrypt(key, salt) return encrypted; } -#ifdef __STDC__ static void encode_base64(u_int8_t *buffer, u_int8_t *data, u_int16_t len) -#else -static void -encode_base64(buffer, data, len) - u_int8_t *buffer; - u_int8_t *data; - u_int16_t len; -#endif { u_int8_t *bp = buffer; u_int8_t *p = data; diff --git a/src/lib/libc/crypt/blowfish.c b/src/lib/libc/crypt/blowfish.c index 695fc00a6a..8be04a6463 100644 --- a/src/lib/libc/crypt/blowfish.c +++ b/src/lib/libc/crypt/blowfish.c @@ -1,4 +1,4 @@ -/* $OpenBSD: blowfish.c,v 1.15 2001/01/04 21:45:30 todd Exp $ */ +/* $OpenBSD: blowfish.c,v 1.16 2002/02/19 19:39:36 millert Exp $ */ /* * Blowfish block cipher for OpenBSD * Copyright 1997 Niels Provos @@ -402,16 +402,8 @@ Blowfish_initstate(c) } -#ifdef __STDC__ u_int32_t Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes, u_int16_t *current) -#else -u_int32_t -Blowfish_stream2word(data, databytes, current) - const u_int8_t *data; - u_int16_t databytes; - u_int16_t *current; -#endif { u_int8_t i; u_int16_t j; @@ -430,16 +422,8 @@ Blowfish_stream2word(data, databytes, current) return temp; } -#if __STDC__ void Blowfish_expand0state(blf_ctx *c, const u_int8_t *key, u_int16_t keybytes) -#else -void -Blowfish_expand0state(c, key, keybytes) - blf_ctx *c; - const u_int8_t *key; - u_int16_t keybytes; -#endif { u_int16_t i; u_int16_t j; @@ -476,19 +460,9 @@ Blowfish_expand0state(c, key, keybytes) } -#if __STDC__ void Blowfish_expandstate(blf_ctx *c, const u_int8_t *data, u_int16_t databytes, const u_int8_t *key, u_int16_t keybytes) -#else -void -Blowfish_expandstate(c, data, databytes, key, keybytes) - blf_ctx *c; - const u_int8_t *data; - u_int16_t databytes; - const u_int8_t *key; - u_int16_t keybytes; -#endif { u_int16_t i; u_int16_t j; @@ -529,16 +503,8 @@ Blowfish_expandstate(c, data, databytes, key, keybytes) } -#if __STDC__ void blf_key(blf_ctx *c, const u_int8_t *k, u_int16_t len) -#else -void -blf_key(c, k, len) - blf_ctx *c; - const u_int8_t *k; - u_int16_t len; -#endif { /* Initialize S-boxes and subkeys with Pi */ Blowfish_initstate(c); @@ -547,16 +513,8 @@ blf_key(c, k, len) Blowfish_expand0state(c, k, len); } -#if __STDC__ void blf_enc(blf_ctx *c, u_int32_t *data, u_int16_t blocks) -#else -void -blf_enc(c, data, blocks) - blf_ctx *c; - u_int32_t *data; - u_int16_t blocks; -#endif { u_int32_t *d; u_int16_t i; @@ -568,16 +526,8 @@ blf_enc(c, data, blocks) } } -#if __STDC__ void blf_dec(blf_ctx *c, u_int32_t *data, u_int16_t blocks) -#else -void -blf_dec(c, data, blocks) - blf_ctx *c; - u_int32_t *data; - u_int16_t blocks; -#endif { u_int32_t *d; u_int16_t i; @@ -589,16 +539,8 @@ blf_dec(c, data, blocks) } } -#if __STDC__ void blf_ecb_encrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) -#else -void -blf_ecb_encrypt(c, data, len) - blf_ctx *c; - u_int8_t *data; - u_int32_t len; -#endif { u_int32_t l, r; u_int32_t i; @@ -619,16 +561,8 @@ blf_ecb_encrypt(c, data, len) } } -#if __STDC__ void blf_ecb_decrypt(blf_ctx *c, u_int8_t *data, u_int32_t len) -#else -void -blf_ecb_decrypt(c, data, len) - blf_ctx *c; - u_int8_t *data; - u_int32_t len; -#endif { u_int32_t l, r; u_int32_t i; @@ -649,17 +583,8 @@ blf_ecb_decrypt(c, data, len) } } -#if __STDC__ void blf_cbc_encrypt(blf_ctx *c, u_int8_t *iv, u_int8_t *data, u_int32_t len) -#else -void -blf_cbc_encrypt(c, iv, data, len) - blf_ctx *c; - u_int8_t *iv; - u_int8_t *data; - u_int32_t len; -#endif { u_int32_t l, r; u_int32_t i, j; @@ -683,17 +608,8 @@ blf_cbc_encrypt(c, iv, data, len) } } -#if __STDC__ void blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len) -#else -void -blf_cbc_decrypt(c, iva, data, len) - blf_ctx *c; - u_int8_t *iva; - u_int8_t *data; - u_int32_t len; -#endif { u_int32_t l, r; u_int8_t *iv; diff --git a/src/lib/libc/net/htons.c b/src/lib/libc/net/htons.c index 47cf25952d..ded70712ea 100644 --- a/src/lib/libc/net/htons.c +++ b/src/lib/libc/net/htons.c @@ -4,7 +4,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: htons.c,v 1.6 1997/07/25 20:30:07 mickey Exp $"; +static char *rcsid = "$OpenBSD: htons.c,v 1.7 2002/02/19 19:39:36 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -13,12 +13,7 @@ static char *rcsid = "$OpenBSD: htons.c,v 1.6 1997/07/25 20:30:07 mickey Exp $"; #undef htons u_int16_t -#ifdef __STDC__ htons(u_int16_t x) -#else -htons(x) - u_int16_t x; -#endif { #if BYTE_ORDER == LITTLE_ENDIAN u_char *s = (u_char *) &x; diff --git a/src/lib/libc/net/ntohs.c b/src/lib/libc/net/ntohs.c index cf6414d4a6..4c3ab33f31 100644 --- a/src/lib/libc/net/ntohs.c +++ b/src/lib/libc/net/ntohs.c @@ -4,7 +4,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: ntohs.c,v 1.6 1997/07/25 20:30:07 mickey Exp $"; +static char *rcsid = "$OpenBSD: ntohs.c,v 1.7 2002/02/19 19:39:36 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -13,12 +13,7 @@ static char *rcsid = "$OpenBSD: ntohs.c,v 1.6 1997/07/25 20:30:07 mickey Exp $"; #undef ntohs u_int16_t -#ifdef __STDC__ ntohs(u_int16_t x) -#else -ntohs(x) - u_int16_t x; -#endif { #if BYTE_ORDER == LITTLE_ENDIAN u_char *s = (u_char *) &x; diff --git a/src/lib/libc/net/res_comp.c b/src/lib/libc/net/res_comp.c index 948923cf37..25e196b2cf 100644 --- a/src/lib/libc/net/res_comp.c +++ b/src/lib/libc/net/res_comp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_comp.c,v 1.9 2002/02/17 19:42:23 millert Exp $ */ +/* $OpenBSD: res_comp.c,v 1.10 2002/02/19 19:39:36 millert Exp $ */ /* * ++Copyright++ 1985, 1993 @@ -60,7 +60,7 @@ static char sccsid[] = "@(#)res_comp.c 8.1 (Berkeley) 6/4/93"; static char rcsid[] = "$From: res_comp.c,v 8.11 1996/12/02 09:17:22 vixie Exp $"; #else -static char rcsid[] = "$OpenBSD: res_comp.c,v 1.9 2002/02/17 19:42:23 millert Exp $"; +static char rcsid[] = "$OpenBSD: res_comp.c,v 1.10 2002/02/19 19:39:36 millert Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -489,13 +489,7 @@ _getlong(msgp) } void -#if defined(__STDC__) || defined(__cplusplus) -__putshort(register u_int16_t s, register u_char *msgp) /* must match proto */ -#else -__putshort(s, msgp) - register u_int16_t s; - register u_char *msgp; -#endif +__putshort(register u_int16_t s, register u_char *msgp) { PUTSHORT(s, msgp); } diff --git a/src/lib/libc/net/res_random.c b/src/lib/libc/net/res_random.c index 6a6a142e96..7a7d0bd677 100644 --- a/src/lib/libc/net/res_random.c +++ b/src/lib/libc/net/res_random.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_random.c,v 1.10 2002/02/16 21:27:23 millert Exp $ */ +/* $OpenBSD: res_random.c,v 1.11 2002/02/19 19:39:36 millert Exp $ */ /* * Copyright 1997 Niels Provos @@ -100,14 +100,8 @@ static void res_initid(void); * of 0 - (mod-1) */ -#ifdef __STDC__ static u_int16_t pmod(u_int16_t gen, u_int16_t exp, u_int16_t mod) -#else -static u_int16_t -pmod(gen, exp, mod) - u_int16_t gen, exp, mod; -#endif { u_int16_t s, t, u; diff --git a/src/lib/libc/stdlib/multibyte.c b/src/lib/libc/stdlib/multibyte.c index 12e70c4a2c..6f08bbe342 100644 --- a/src/lib/libc/stdlib/multibyte.c +++ b/src/lib/libc/stdlib/multibyte.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: multibyte.c,v 1.2 1996/08/19 08:33:39 tholo Exp $"; +static char *rcsid = "$OpenBSD: multibyte.c,v 1.3 2002/02/19 19:39:37 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include @@ -73,13 +73,7 @@ mbtowc(pwc, s, n) /*ARGSUSED*/ int -#ifdef __STDC__ wctomb(char *s, wchar_t wchar) -#else -wctomb(s, wchar) - char *s; - wchar_t wchar; -#endif { if (s == NULL) return 0; diff --git a/src/lib/libc/stdlib/strtod.c b/src/lib/libc/stdlib/strtod.c index 44cc369b16..ce7ce9fe56 100644 --- a/src/lib/libc/stdlib/strtod.c +++ b/src/lib/libc/stdlib/strtod.c @@ -90,7 +90,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strtod.c,v 1.14 2001/07/09 06:57:45 deraadt Exp $"; +static char *rcsid = "$OpenBSD: strtod.c,v 1.15 2002/02/19 19:39:37 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ @@ -153,7 +153,6 @@ extern void *MALLOC(size_t); #include "errno.h" #ifdef Bad_float_h -#undef __STDC__ #ifdef IEEE_BIG_ENDIAN #define IEEE_ARITHMETIC #endif @@ -1429,7 +1428,7 @@ strtod if (e1 > DBL_MAX_10_EXP) { ovfl: errno = ERANGE; -#ifdef __STDC__ +#ifndef Bad_float_h value(rv) = HUGE_VAL; #else /* Can't trust HUGE_VAL */ diff --git a/src/regress/lib/libc/db/dbtest.c b/src/regress/lib/libc/db/dbtest.c index 53451c5438..a48e19c452 100644 --- a/src/regress/lib/libc/db/dbtest.c +++ b/src/regress/lib/libc/db/dbtest.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dbtest.c,v 1.8 2002/02/18 21:40:46 millert Exp $ */ +/* $OpenBSD: dbtest.c,v 1.9 2002/02/19 19:39:38 millert Exp $ */ /* $NetBSD: dbtest.c,v 1.8 1996/05/03 21:57:48 cgd Exp $ */ /*- @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dbtest.c 8.17 (Berkeley) 9/1/94"; #else -static char rcsid[] = "$OpenBSD: dbtest.c,v 1.8 2002/02/18 21:40:46 millert Exp $"; +static char rcsid[] = "$OpenBSD: dbtest.c,v 1.9 2002/02/19 19:39:38 millert Exp $"; #endif #endif /* not lint */ @@ -58,6 +58,7 @@ static char rcsid[] = "$OpenBSD: dbtest.c,v 1.8 2002/02/18 21:40:46 millert Exp #include #include #include +#include #include #include @@ -737,27 +738,12 @@ usage() exit(1); } -#ifdef __STDC__ -#include -#else -#include -#endif - void -#ifdef __STDC__ dberr(const char *fmt, ...) -#else -dberr(fmt, va_alist) - char *fmt; - va_dcl -#endif { va_list ap; -#ifdef __STDC__ + va_start(ap, fmt); -#else - va_start(ap); -#endif (void)fprintf(stderr, "dbtest: "); (void)vfprintf(stderr, fmt, ap); va_end(ap); -- cgit v1.2.3-55-g6feb