diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-01-04 14:23:44 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-01-04 14:23:44 +0000 |
commit | 02f5d8f817cf9629b1ed485751bff2b9991f0b92 (patch) | |
tree | a3e6c97e74239263bf5ce19b39759db076685e07 /usr.sbin/config/hash.c | |
parent | 3cc0fdf59cb12a9819c742bfd4c26bbb22c31421 (diff) |
Add rmoption/rmoptions; useful for people who want a slightly
modified version of GENERIC.
Diffstat (limited to 'usr.sbin/config/hash.c')
-rw-r--r-- | usr.sbin/config/hash.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/usr.sbin/config/hash.c b/usr.sbin/config/hash.c index 9110386046d..735213d0dc8 100644 --- a/usr.sbin/config/hash.c +++ b/usr.sbin/config/hash.c @@ -1,4 +1,4 @@ -/* $OpenBSD: hash.c,v 1.6 1997/08/07 10:36:57 deraadt Exp $ */ +/* $OpenBSD: hash.c,v 1.7 2000/01/04 14:23:43 angelos Exp $ */ /* $NetBSD: hash.c,v 1.4 1996/11/07 22:59:43 gwr Exp $ */ /* @@ -250,6 +250,39 @@ ht_new() } /* + * Remove. + */ +int +ht_remove(ht, nam) + register struct hashtab *ht; + register const char *nam; +{ + register struct hashent *hp, *thp; + register u_int h; + + h = hash(nam); + hp = ht->ht_tab[h & ht->ht_mask]; + while (hp && hp->h_name == nam) { + ht->ht_tab[h & ht->ht_mask] = hp->h_next; + /* XXX Free hp ? */ + hp = ht->ht_tab[h & ht->ht_mask]; + } + + if ((hp = ht->ht_tab[h & ht->ht_mask]) == NULL) + return (0); + + for (thp = hp->h_next; thp != NULL; thp = hp->h_next) { + if (thp->h_name == nam) { + hp->h_next = thp->h_next; + /* XXX Free hp ? */ + } else + hp = thp; + } + + return (0); +} + +/* * Insert and/or replace. */ int |