Freelist links through scid of unused entries. */
| 362 | |
| 363 | /* Freelist links through scid of unused entries. */ |
| 364 | static struct gossmap_chan *next_free_chan(struct gossmap *map) |
| 365 | { |
| 366 | size_t f; |
| 367 | |
| 368 | if (map->freed_chans == UINT_MAX) { |
| 369 | /* Double in size, add second half to free list */ |
| 370 | size_t n = tal_count(map->chan_arr); |
| 371 | map->num_chan_arr *= 2; |
| 372 | tal_resize(&map->chan_arr, n * 2); |
| 373 | map->freed_chans = init_chan_arr(map->chan_arr, n); |
| 374 | } |
| 375 | |
| 376 | f = map->freed_chans; |
| 377 | map->freed_chans = map->chan_arr[f].cann_off; |
| 378 | return &map->chan_arr[f]; |
| 379 | } |
| 380 | |
| 381 | static struct gossmap_chan *new_channel(struct gossmap *map, |
| 382 | u64 cannounce_off, |
no test coverage detected