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

Function htable_get

ccan/ccan/htable/htable.h:224–237  ·  view source on GitHub ↗

* htable_get - find an entry in the hash table * @ht: the hashtable * @h: the hash value of the entry * @cmp: the comparison function * @ptr: the pointer to hand to the comparison function. * * Convenient inline wrapper for htable_firstval/htable_nextval loop. */

Source from the content-addressed store, hash-verified

222 * Convenient inline wrapper for htable_firstval/htable_nextval loop.
223 */
224static inline void *htable_get(const struct htable *ht,
225 size_t h,
226 bool (*cmp)(const void *candidate, void *ptr),
227 const void *ptr)
228{
229 struct htable_iter i;
230 void *c;
231
232 for (c = htable_firstval(ht,&i,h); c; c = htable_nextval(ht,&i,h)) {
233 if (cmp(c, (void *)ptr))
234 return c;
235 }
236 return NULL;
237}
238
239/**
240 * htable_first - find an entry in the hash table

Callers 11

add_valsFunction · 0.85
refill_valsFunction · 0.85
find_valsFunction · 0.85
mainFunction · 0.85
add_valsFunction · 0.85
refill_valsFunction · 0.85
find_valsFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85
memleak_getFunction · 0.85

Calls 1

cmpFunction · 0.50

Tested by 10

add_valsFunction · 0.68
refill_valsFunction · 0.68
find_valsFunction · 0.68
mainFunction · 0.68
add_valsFunction · 0.68
refill_valsFunction · 0.68
find_valsFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68
mainFunction · 0.68