* and its expected representation */
struct nexthop_chain {
/* Head of the chain */
- struct nexthop *head;
+ struct nexthop_group head;
/* Last nexthop in top chain */
struct nexthop *current_top;
/* Last nexthop in current recursive chain */
nh = calloc(sizeof(*nh), 1);
assert(nh);
- if (nc->head) {
+ if (nc->head.nexthop) {
nc->current_top->next = nh;
nh->prev = nc->current_top;
nc->current_top = nh;
} else {
- nc->head = nc->current_top = nh;
+ nc->head.nexthop = nc->current_top = nh;
}
nc->current_recursive = NULL;
str_appendf(&nc->repr, "%p\n", nh);
}
static void nexthop_chain_clear(struct nexthop_chain *nc)
{
- nexthop_clear_recursive(nc->head);
- nc->head = nc->current_top = nc->current_recursive = NULL;
+ nexthop_clear_recursive(nc->head.nexthop);
+ nc->head.nexthop = nc->current_top = nc->current_recursive = NULL;
free(nc->repr);
nc->repr = NULL;
}