diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-28 04:55:08 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-06-28 04:55:08 +0000 |
commit | 404112110e1cb4033a1ad9b5f10bffe7134e18e3 (patch) | |
tree | 5198c8f9b20a97eeae9f794209365e1fe46d8f78 /usr.sbin/config/hash.c | |
parent | a98736561f69c746fdaf57749c4a1eaece796924 (diff) |
ansi & prototype cleanup. tested in mkr on most arch's. ok dhartmei
Diffstat (limited to 'usr.sbin/config/hash.c')
-rw-r--r-- | usr.sbin/config/hash.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/usr.sbin/config/hash.c b/usr.sbin/config/hash.c index c6b0504f646..2ee2d6e1740 100644 --- a/usr.sbin/config/hash.c +++ b/usr.sbin/config/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.12 2003/06/02 23:36:52 millert Exp $ */ +/* $OpenBSD: hash.c,v 1.13 2003/06/28 04:55:07 deraadt Exp $ */ /* $NetBSD: hash.c,v 1.4 1996/11/07 22:59:43 gwr Exp $ */ /* @@ -86,12 +86,14 @@ static struct hashtab strings; /* round up to next multiple of y, where y is a power of 2 */ #define ROUND(x, y) (((x) + (y) - 1) & ~((y) - 1)) +static void *poolalloc(size_t); +static void ht_init(struct hashtab *, size_t); +static void ht_expand(struct hashtab *); /* * Allocate space that will never be freed. */ static void * -poolalloc(size) - size_t size; +poolalloc(size_t size) { char *p; size_t alloc; @@ -119,9 +121,7 @@ poolalloc(size) * Initialize a new hash table. The size must be a power of 2. */ static void -ht_init(ht, sz) - struct hashtab *ht; - size_t sz; +ht_init(struct hashtab *ht, size_t sz) { struct hashent **h; u_int n; @@ -140,8 +140,7 @@ ht_init(ht, sz) * Expand an existing hash table. */ static void -ht_expand(ht) - struct hashtab *ht; +ht_expand(struct hashtab *ht) { struct hashent *p, **h, **oldh, *q; u_int n, i; @@ -197,7 +196,7 @@ hash(const char *str) } void -initintern() +initintern(void) { ht_init(&strings, 128); @@ -208,8 +207,7 @@ initintern() * function to be used frequently, so it should be fast. */ const char * -intern(s) - const char *s; +intern(const char *s) { struct hashtab *ht; struct hashent *hp, **hpp; @@ -233,7 +231,7 @@ intern(s) } struct hashtab * -ht_new() +ht_new(void) { struct hashtab *ht; @@ -246,9 +244,7 @@ ht_new() * Remove. */ int -ht_remove(ht, nam) - struct hashtab *ht; - const char *nam; +ht_remove(struct hashtab *ht, const char *nam) { struct hashent *hp, *thp; u_int h; @@ -279,11 +275,7 @@ ht_remove(ht, nam) * Insert and/or replace. */ int -ht_insrep(ht, nam, val, replace) - struct hashtab *ht; - const char *nam; - void *val; - int replace; +ht_insrep(struct hashtab *ht, const char *nam, void *val, int replace) { struct hashent *hp, **hpp; u_int h; @@ -305,9 +297,7 @@ ht_insrep(ht, nam, val, replace) } void * -ht_lookup(ht, nam) - struct hashtab *ht; - const char *nam; +ht_lookup(struct hashtab *ht, const char *nam) { struct hashent *hp, **hpp; u_int h; |