Example #1
0
File: htab.c Project: kirbyfan64/mc
/* Looks up a key, returning NULL if
 * the value is not present. Note,
 * if NULL is a valid value, you need
 * to check with hthas() to see if it's
 * not there */
void *htget(Htab *ht, void *k)
{
	ssize_t i;

	i = htidx(ht, k);
	if (i < 0)
		return NULL;
	else
		return ht->vals[i];
}
Example #2
0
void htdel(Htab *ht, void *k)
{
    ssize_t i;

    i = htidx(ht, k);
    if (i < 0)
        return;
    ht->dead[i] = 1;
    ht->nelt--;
}
Example #3
0
File: htab.c Project: kirbyfan64/mc
void htdel(Htab *ht, void *k)
{
	ssize_t i;

	i = htidx(ht, k);
	if (i < 0)
		return;
	assert(!ht->dead[i]);
	assert(ht->hashes[i]);
	ht->dead[i] = 1;
	ht->nelt--;
	ht->ndead++;
}
Example #4
0
File: htab.c Project: kirbyfan64/mc
/* Tests for 'k's presence in 'ht' */
int hthas(Htab *ht, void *k) { return htidx(ht, k) >= 0; }