MCPcopy Create free account
hub / github.com/ElementsProject/lightning / htable_add_

Function htable_add_

ccan/ccan/htable/htable.c:378–399  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378bool htable_add_(struct htable *ht, size_t hash, const void *p)
379{
380 /* Cannot insert NULL, or (void *)1. */
381 assert(p);
382 assert(entry_is_valid((uintptr_t)p));
383
384 /* Getting too full? */
385 if (ht->elems+1 + ht->deleted > ht_max(ht)) {
386 /* If we're more than 1/8 deleted, clean those,
387 * otherwise double table size. */
388 if (ht->deleted > ht_max_deleted(ht))
389 rehash_table(ht);
390 else if (!double_table(ht))
391 return false;
392 }
393 if (((uintptr_t)p & ht->common_mask) != ht->common_bits)
394 update_common(ht, p);
395
396 ht_add(ht, p, hash);
397 ht->elems++;
398 return true;
399}
400
401bool htable_del_(struct htable *ht, size_t h, const void *p)
402{

Callers

nothing calls this directly

Calls 7

entry_is_validFunction · 0.85
ht_maxFunction · 0.85
ht_max_deletedFunction · 0.85
rehash_tableFunction · 0.85
double_tableFunction · 0.85
update_commonFunction · 0.85
ht_addFunction · 0.85

Tested by

no test coverage detected