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

Function next_free_node

common/gossmap.c:267–282  ·  view source on GitHub ↗

Freelist links through node_off of unused entries. */

Source from the content-addressed store, hash-verified

265
266/* Freelist links through node_off of unused entries. */
267static struct gossmap_node *next_free_node(struct gossmap *map)
268{
269 size_t f;
270
271 if (map->freed_nodes == UINT_MAX) {
272 /* Double in size, add second half to free list */
273 size_t n = tal_count(map->node_arr);
274 map->num_node_arr *= 2;
275 tal_resize(&map->node_arr, n * 2);
276 map->freed_nodes = init_node_arr(map->node_arr, n);
277 }
278
279 f = map->freed_nodes;
280 map->freed_nodes = map->node_arr[f].nann_off;
281 return &map->node_arr[f];
282}
283
284static u32 new_node(struct gossmap *map)
285{

Callers 1

new_nodeFunction · 0.85

Calls 1

init_node_arrFunction · 0.85

Tested by

no test coverage detected