From 7a3869478aaa00342a6948e27b1139b6b252529d Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Tue, 3 Sep 2002 21:56:52 +0000 Subject: [PATCH] protoize git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@14821 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/ChangeLog | 9 +++++++++ src/lib/krb5/rcache/rc_base.c | 28 +++++++--------------------- src/lib/krb5/rcache/rc_conv.c | 5 +---- src/lib/krb5/rcache/rc_dfl.c | 14 +++++++------- src/lib/krb5/rcache/rc_io.c | 30 +++++++++++++----------------- src/lib/krb5/rcache/ser_rc.c | 20 ++++---------------- 6 files changed, 41 insertions(+), 65 deletions(-) diff --git a/src/lib/krb5/rcache/ChangeLog b/src/lib/krb5/rcache/ChangeLog index 6cb7f3abf..cd950d086 100644 --- a/src/lib/krb5/rcache/ChangeLog +++ b/src/lib/krb5/rcache/ChangeLog @@ -1,3 +1,12 @@ +2002-09-03 Ken Raeburn + + * rc_base.c, rc_conv.c, rc_io.c, ser_rc.c: Use prototype style + function definitions. + + * rc_io.c (errno): Don't declare. + (krb5_rc_io_move): Avoid variable name "new". + * rc_dfl.c (cmp, alive): Avoid variable name "new". + 2002-08-29 Ken Raeburn * Makefile.in: Revert $(S)=>/ change, for Windows support. diff --git a/src/lib/krb5/rcache/rc_base.c b/src/lib/krb5/rcache/rc_base.c index c24f2ebad..96532f773 100644 --- a/src/lib/krb5/rcache/rc_base.c +++ b/src/lib/krb5/rcache/rc_base.c @@ -30,9 +30,7 @@ static struct krb5_rc_typelist *typehead = &krb5_rc_typelist_dfl; semaphore ex_typelist = 1; #endif -krb5_error_code krb5_rc_register_type(context, ops) - krb5_context context; - krb5_rc_ops *ops; +krb5_error_code krb5_rc_register_type(krb5_context context, krb5_rc_ops *ops) { struct krb5_rc_typelist *t; #ifdef SEMAPHORE @@ -59,10 +57,7 @@ krb5_error_code krb5_rc_register_type(context, ops) return 0; } -krb5_error_code krb5_rc_resolve_type(context, id, type) - krb5_context context; - krb5_rcache *id; - char *type; +krb5_error_code krb5_rc_resolve_type(krb5_context context, krb5_rcache *id, char *type) { struct krb5_rc_typelist *t; #ifdef SEMAPHORE @@ -80,15 +75,12 @@ krb5_error_code krb5_rc_resolve_type(context, id, type) return 0; } -char * krb5_rc_get_type(context, id) - krb5_context context; - krb5_rcache id; +char * krb5_rc_get_type(krb5_context context, krb5_rcache id) { return id->ops->type; } -char * krb5_rc_default_type(context) - krb5_context context; +char * krb5_rc_default_type(krb5_context context) { char *s; if ((s = getenv("KRB5RCACHETYPE"))) @@ -97,8 +89,7 @@ char * krb5_rc_default_type(context) return "dfl"; } -char * krb5_rc_default_name(context) - krb5_context context; +char * krb5_rc_default_name(krb5_context context) { char *s; if ((s = getenv("KRB5RCACHENAME"))) @@ -108,9 +99,7 @@ char * krb5_rc_default_name(context) } krb5_error_code -krb5_rc_default(context, id) - krb5_context context; - krb5_rcache *id; +krb5_rc_default(krb5_context context, krb5_rcache *id) { krb5_error_code retval; @@ -130,10 +119,7 @@ krb5_rc_default(context, id) } -krb5_error_code krb5_rc_resolve_full(context, id, string_name) - krb5_context context; - krb5_rcache *id; - char *string_name; +krb5_error_code krb5_rc_resolve_full(krb5_context context, krb5_rcache *id, char *string_name) { char *type; char *residual; diff --git a/src/lib/krb5/rcache/rc_conv.c b/src/lib/krb5/rcache/rc_conv.c index db20f3ffe..8eb73ccbe 100644 --- a/src/lib/krb5/rcache/rc_conv.c +++ b/src/lib/krb5/rcache/rc_conv.c @@ -22,10 +22,7 @@ Local stuff: */ krb5_error_code -krb5_auth_to_rep(context, auth, rep) - krb5_context context; - krb5_tkt_authent *auth; - krb5_donot_replay *rep; +krb5_auth_to_rep(krb5_context context, krb5_tkt_authent *auth, krb5_donot_replay *rep) { krb5_error_code retval; rep->cusec = auth->authenticator->cusec; diff --git a/src/lib/krb5/rcache/rc_dfl.c b/src/lib/krb5/rcache/rc_dfl.c index 26de94c32..b6c669b22 100644 --- a/src/lib/krb5/rcache/rc_dfl.c +++ b/src/lib/krb5/rcache/rc_dfl.c @@ -78,25 +78,25 @@ hash(krb5_donot_replay *rep, int hsize) /*ARGSUSED*/ static int -cmp(krb5_donot_replay *old, krb5_donot_replay *new, krb5_deltat t) +cmp(krb5_donot_replay *old, krb5_donot_replay *new1, krb5_deltat t) { - if ((old->cusec == new->cusec) && /* most likely to distinguish */ - (old->ctime == new->ctime) && - (strcmp(old->client, new->client) == 0) && - (strcmp(old->server, new->server) == 0)) /* always true */ + if ((old->cusec == new1->cusec) && /* most likely to distinguish */ + (old->ctime == new1->ctime) && + (strcmp(old->client, new1->client) == 0) && + (strcmp(old->server, new1->server) == 0)) /* always true */ return CMP_REPLAY; return CMP_HOHUM; } static int -alive(krb5_context context, krb5_donot_replay *new, krb5_deltat t) +alive(krb5_context context, krb5_donot_replay *new1, krb5_deltat t) { krb5_int32 mytime; if (krb5_timeofday(context, &mytime)) return CMP_HOHUM; /* who cares? */ /* I hope we don't have to worry about overflow */ - if (new->ctime + t < mytime) + if (new1->ctime + t < mytime) return CMP_EXPIRED; return CMP_HOHUM; } diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index e44d77c3d..5d0c4a820 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -39,10 +39,6 @@ #error find some way to use net-byte-order file version numbers. #endif -#ifndef HAVE_ERRNO -extern int errno; /* this should be in errno.h, but isn't on some systems */ -#endif - #define FREE(x) ((void) free((char *) (x))) #define UNIQUE getpid() /* hopefully unique number */ @@ -56,7 +52,7 @@ static char *dir; #define GETDIR do { if (!dirlen) getdir(); } while(0) static void -getdir() +getdir(void) { if (!(dir = getenv("KRB5RCACHEDIR"))) { #if defined(_WIN32) @@ -272,7 +268,7 @@ krb5_rc_io_open(krb5_context context, krb5_rc_iostuff *d, char *fn) } krb5_error_code -krb5_rc_io_move(krb5_context context, krb5_rc_iostuff *new, +krb5_rc_io_move(krb5_context context, krb5_rc_iostuff *new1, krb5_rc_iostuff *old) { #if defined(_WIN32) @@ -304,10 +300,10 @@ krb5_rc_io_move(krb5_context context, krb5_rc_iostuff *new, */ offset = lseek(old->fd, 0, SEEK_CUR); - new_fn = new->fn; - new->fn = NULL; + new_fn = new1->fn; + new1->fn = NULL; close(new->fd); - new->fd = -1; + new1->fd = -1; unlink(new_fn); @@ -321,7 +317,7 @@ krb5_rc_io_move(krb5_context context, krb5_rc_iostuff *new, goto cleanup; } - retval = krb5_rc_io_open_internal(context, new, 0, new_fn); + retval = krb5_rc_io_open_internal(context, new1, 0, new_fn); if (retval) goto cleanup; @@ -336,16 +332,16 @@ krb5_rc_io_move(krb5_context context, krb5_rc_iostuff *new, return retval; #else char *fn = NULL; - if (rename(old->fn, new->fn) == -1) /* MUST be atomic! */ + if (rename(old->fn, new1->fn) == -1) /* MUST be atomic! */ return KRB5_RC_IO_UNKNOWN; - fn = new->fn; - new->fn = NULL; /* avoid clobbering */ - (void) krb5_rc_io_close(context, new); - new->fn = fn; + fn = new1->fn; + new1->fn = NULL; /* avoid clobbering */ + (void) krb5_rc_io_close(context, new1); + new1->fn = fn; #ifdef macintosh - new->fd = fcntl(old->fd, F_DUPFD); + new1->fd = fcntl(old->fd, F_DUPFD); #else - new->fd = dup(old->fd); + new1->fd = dup(old->fd); #endif return 0; #endif diff --git a/src/lib/krb5/rcache/ser_rc.c b/src/lib/krb5/rcache/ser_rc.c index a4ed0f88b..2aa4eb343 100644 --- a/src/lib/krb5/rcache/ser_rc.c +++ b/src/lib/krb5/rcache/ser_rc.c @@ -58,10 +58,7 @@ static const krb5_ser_entry krb5_rcache_ser_entry = { * this krb5_rcache variant. */ static krb5_error_code -krb5_rcache_size(kcontext, arg, sizep) - krb5_context kcontext; - krb5_pointer arg; - size_t *sizep; +krb5_rcache_size(krb5_context kcontext, krb5_pointer arg, size_t *sizep) { krb5_error_code kret; krb5_rcache rcache; @@ -95,11 +92,7 @@ krb5_rcache_size(kcontext, arg, sizep) * krb5_rcache_externalize() - Externalize the krb5_rcache. */ static krb5_error_code -krb5_rcache_externalize(kcontext, arg, buffer, lenremain) - krb5_context kcontext; - krb5_pointer arg; - krb5_octet **buffer; - size_t *lenremain; +krb5_rcache_externalize(krb5_context kcontext, krb5_pointer arg, krb5_octet **buffer, size_t *lenremain) { krb5_error_code kret; krb5_rcache rcache; @@ -159,11 +152,7 @@ krb5_rcache_externalize(kcontext, arg, buffer, lenremain) * krb5_rcache_internalize() - Internalize the krb5_rcache. */ static krb5_error_code -krb5_rcache_internalize(kcontext, argp, buffer, lenremain) - krb5_context kcontext; - krb5_pointer *argp; - krb5_octet **buffer; - size_t *lenremain; +krb5_rcache_internalize(krb5_context kcontext, krb5_pointer *argp, krb5_octet **buffer, size_t *lenremain) { krb5_error_code kret; krb5_rcache rcache; @@ -212,8 +201,7 @@ krb5_rcache_internalize(kcontext, argp, buffer, lenremain) * Register the rcache serializer. */ krb5_error_code KRB5_CALLCONV -krb5_ser_rcache_init(kcontext) - krb5_context kcontext; +krb5_ser_rcache_init(krb5_context kcontext) { return(krb5_register_serializer(kcontext, &krb5_rcache_ser_entry)); } -- 2.26.2