MCPcopy Create free account
hub / github.com/acl-dev/acl / debug_htable_delete

Function debug_htable_delete

lib_acl/src/stdlib/debug/debug_htable.c:237–266  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235/* debug_htable_delete - delete one entry */
236
237int debug_htable_delete(DEBUG_HTABLE *table, const char *key, void (*free_fn) (char *))
238{
239 if (table && key) {
240 DEBUG_HTABLE_INFO *ht;
241 unsigned n = table->hash_fn(key, strlen(key));
242 DEBUG_HTABLE_INFO **h;
243
244 n = n % table->size;
245
246 h = table->data + n;
247 for (ht = *h; ht; ht = ht->next) {
248 if (STREQ(key, ht->key)) {
249 if (ht->next)
250 ht->next->prev = ht->prev;
251 if (ht->prev)
252 ht->prev->next = ht->next;
253 else
254 *h = ht->next;
255 table->used--;
256 FREE(ht->key);
257 if (free_fn && ht->value)
258 (*free_fn) (ht->value);
259 FREE(ht);
260 return(0);
261 }
262 }
263 }
264
265 return(-1);
266}
267
268/* debug_htable_free - destroy hash table */
269

Callers 2

acl_debug_reallocFunction · 0.85
acl_debug_freeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…