--- ray/src/common/lookup.c 2004/05/25 22:04:13 2.15 +++ ray/src/common/lookup.c 2014/02/09 00:08:18 2.19 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: lookup.c,v 2.15 2004/05/25 22:04:13 greg Exp $"; +static const char RCSid[] = "$Id: lookup.c,v 2.19 2014/02/09 00:08:18 greg Exp $"; #endif /* * Table lookup routines @@ -7,21 +7,14 @@ static const char RCSid[] = "$Id: lookup.c,v 2.15 2004 #include #include +#include #include "lookup.h" -extern int -lu_strcmp( - const void *s1, - const void *s2 -) -{ - return strcmp((const char*)s1,(const char*)s2); -} -extern int +int lu_init( /* initialize tbl for at least nel elements */ - register LUTAB *tbl, + LUTAB *tbl, int nel ) { @@ -30,7 +23,7 @@ lu_init( /* initialize tbl for at least nel elements 32749, 65521, 131071, 262139, 524287, 1048573, 2097143, 4194301, 8388593, 0 }; - register int *hsp; + int *hsp; nel += nel>>1; /* 66% occupancy */ for (hsp = hsiztab; *hsp; hsp++) @@ -46,9 +39,9 @@ lu_init( /* initialize tbl for at least nel elements } -extern unsigned long +unsigned long lu_shash( /* hash a nul-terminated string */ - const void *s + const char *s ) { static unsigned char shuffle[256] = { @@ -77,9 +70,9 @@ lu_shash( /* hash a nul-terminated string */ 106, 7, 164, 65, 222, 123, 24, 181, 82, 239, 140, 41, 198, 99 }; - register int i = 0; - register unsigned long h = 0; - register unsigned const char *t = (unsigned const char *)s; + int i = 0; + unsigned long h = 0; + unsigned const char *t = (unsigned const char *)s; while (*t) h ^= (unsigned long)shuffle[*t++] << ((i+=11) & 0xf); @@ -88,16 +81,16 @@ lu_shash( /* hash a nul-terminated string */ } -extern LUENT * +LUENT * lu_find( /* find a table entry */ - register LUTAB *tbl, + LUTAB *tbl, const char *key ) { unsigned long hval; int i, n; - register int ndx; - register LUENT *le; + int ndx; + LUENT *le; /* look up object */ if (tbl->tsiz == 0 && !lu_init(tbl, 1)) return(NULL); @@ -144,13 +137,13 @@ tryagain: } -extern void +void lu_delete( /* delete a table entry */ - register LUTAB *tbl, - const char *key + LUTAB *tbl, + const char *key ) { - register LUENT *le; + LUENT *le; if ((le = lu_find(tbl, key)) == NULL) return; @@ -163,16 +156,16 @@ lu_delete( /* delete a table entry */ } -extern int +int lu_doall( /* loop through all valid table entries */ - register const LUTAB *tbl, - //int (*f)(const LUENT *) + const LUTAB *tbl, + /* int (*f)(const LUENT *, void *) */ lut_doallf_t *f, void *p ) { int rval = 0; - register const LUENT *tp; + const LUENT *tp; for (tp = tbl->tabl + tbl->tsiz; tp-- > tbl->tabl; ) if (tp->data != NULL) { @@ -188,12 +181,12 @@ lu_doall( /* loop through all valid table entries */ } -extern void +void lu_done( /* free table and contents */ - register LUTAB *tbl + LUTAB *tbl ) { - register LUENT *tp; + LUENT *tp; if (!tbl->tsiz) return;