Macaulay2 Engine
Loading...
Searching...
No Matches

◆ Table_remove()

void * Table_remove ( T * table,
const void * key )

Definition at line 134 of file table.c.

135{
136 int i;
137 struct binding **pp;
138 assert(table);
139 assert(key);
140 table->timestamp++;
141 i = (*table->hash)(key) % table->size;
142 for (pp = &table->buckets[i]; *pp; pp = &(*pp)->link)
143 if ((*table->cmp)(key, (*pp)->key) == 0)
144 {
145 struct binding *p = *pp;
146 void *value = p->value;
147 *pp = p->link;
148 FREE(p);
149 table->length--;
150 return value;
151 }
152 return NULL;
153}
int p
struct binding * link
Definition table.c:43
int size
Definition table.c:30
unsigned timestamp
Definition table.c:34
int length
Definition table.c:33
unsigned(* hash)(const void *key)
Definition table.c:32
int(* cmp)(const void *x, const void *y)
Definition table.c:31
struct T::binding ** buckets
#define FREE(ptr)
Definition table.c:11

References T::buckets, T::cmp, FREE, T::hash, T::length, T::binding::link, p, T::size, T, and T::timestamp.