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

Function intmap_get_

ccan/ccan/intmap/intmap.c:35–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33}
34
35void *intmap_get_(const struct intmap *map, intmap_index_t index)
36{
37 /* Not empty map? */
38 if (!intmap_empty_(map)) {
39 const struct intmap *n = map;
40 /* Anything with NULL value is a node. */
41 while (!n->v) {
42 /* FIXME: compare cmp prefix, if not equal, ENOENT */
43 u8 direction = (index >> critbit(n)) & 1;
44 n = &n->u.n->child[direction];
45 }
46 if (index == n->u.i)
47 return n->v;
48 }
49 errno = ENOENT;
50 return NULL;
51}
52
53static bool split_node(struct intmap *n, intmap_index_t nodeindex,
54 intmap_index_t index, const void *value)

Callers

nothing calls this directly

Calls 2

intmap_empty_Function · 0.85
critbitFunction · 0.85

Tested by

no test coverage detected