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