4.3BSD/usr/contrib/spms/src/lib/libhash/src/htlookup.c

Compare this file to the similar file:
Show the results in this format:

/* $Header$ */

/*
 * Author: Peter J. Nicklin
 */

/*
 * htlookup() returns a pointer to a hash table entry if found, otherwise null.
 */
#include "null.h"
#include "hash.h"
#include "macro.h"

HASHBLK *
htlookup(key, hash)
	char *key;			/* key for hash table entry */
	HASH *hash;			/* hash table */
{
	HASHBLK *htb;			/* hash table entry block */
	int hthash();			/* calculate hash value */

	for (htb = (hash->hashtab)[hthash(key, hash)]; htb != NULL; htb = htb->h_next)
		if (EQUAL(htb->h_key, key))
			return(htb);	/* found */
	return(NULL);			/* not found */
}