Lines Matching +defs:hash +defs:table

1 /*	$NetBSD: hash.c,v 1.5 2009/04/19 06:06:40 lukem Exp $ */
38 __RCSID("$NetBSD: hash.c,v 1.5 2009/04/19 06:06:40 lukem Exp $");
47 #include "hash.h"
49 u_int32_t hash(const void *, size_t);
54 * This hash function is stolen directly from the
61 * OZ's original sdbm hash
64 hash(const void *keyarg, size_t len)
109 * Generate a hash value for a given key (character string).
110 * We mask off all but the lower 8 bits since our table array
119 return(hash((const void *)key, strlen(key)) & HASH_MASK);
122 /* Find an entry in the hash table (may be hanging off a linked list). */
124 lookup(struct group_entry **table, const char *key)
128 cur = table[hashkey(key)];
140 * Store an entry in the main netgroup hash table. Here's how this
141 * works: the table can only be so big when we initialize it (TABLESIZE)
143 * much larger than the table. Since our hash values are adjusted to
145 * we find ourselves with two keys that hash to the same value.
147 * One way to deal with this is to malloc(2) a second table and start
150 * we turn each table entry into a linked list and simply link keys
151 * with the same hash value together at the same index location within
152 * the table.
157 store(struct group_entry *table[], const char *key, const char *data)
167 new->next = table[i];
168 table[i] = new;
176 * maintain not only the hash table of group members, each group member
179 * two things: add that member to the table (possibly hanging them
182 * an entry in the table, then we just have to do one thing, which is
186 mstore(struct member_entry *table[], const char *key, const char *data,
194 cur = table[i];
219 /* Didn't find a match -- add the whole mess to the table. */
224 new->next = table[i];
225 table[i] = new;