Some minor sl_allocz() cleanups
This commit is contained in:
parent
db2d29073a
commit
c9ae81656f
5 changed files with 6 additions and 11 deletions
|
@ -253,9 +253,7 @@ neigh_find(struct proto *p, ip_addr a, struct iface *iface, uint flags)
|
||||||
if ((scope < 0) && !(flags & NEF_STICKY))
|
if ((scope < 0) && !(flags & NEF_STICKY))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
n = sl_alloc(neigh_slab);
|
n = sl_allocz(neigh_slab);
|
||||||
memset(n, 0, sizeof(neighbor));
|
|
||||||
|
|
||||||
add_tail(&neigh_hash_table[h], &n->n);
|
add_tail(&neigh_hash_table[h], &n->n);
|
||||||
add_tail((scope >= 0) ? &iface->neighbors : &sticky_neigh_list, &n->if_n);
|
add_tail((scope >= 0) ? &iface->neighbors : &sticky_neigh_list, &n->if_n);
|
||||||
n->addr = a;
|
n->addr = a;
|
||||||
|
|
|
@ -135,7 +135,7 @@ rt_get_source(struct proto *p, u32 id)
|
||||||
if (src)
|
if (src)
|
||||||
return src;
|
return src;
|
||||||
|
|
||||||
src = sl_alloc(rte_src_slab);
|
src = sl_allocz(rte_src_slab);
|
||||||
src->proto = p;
|
src->proto = p;
|
||||||
src->private_id = id;
|
src->private_id = id;
|
||||||
src->global_id = idm_alloc(&src_ids);
|
src->global_id = idm_alloc(&src_ids);
|
||||||
|
@ -366,7 +366,7 @@ nexthop_copy(struct nexthop *o)
|
||||||
|
|
||||||
for (; o; o = o->next)
|
for (; o; o = o->next)
|
||||||
{
|
{
|
||||||
struct nexthop *n = sl_alloc(nexthop_slab(o));
|
struct nexthop *n = sl_allocz(nexthop_slab(o));
|
||||||
n->gw = o->gw;
|
n->gw = o->gw;
|
||||||
n->iface = o->iface;
|
n->iface = o->iface;
|
||||||
n->next = NULL;
|
n->next = NULL;
|
||||||
|
|
|
@ -423,9 +423,7 @@ bfd_add_session(struct bfd_proto *p, ip_addr addr, ip_addr local, struct iface *
|
||||||
|
|
||||||
struct bfd_iface *ifa = bfd_get_iface(p, local, iface);
|
struct bfd_iface *ifa = bfd_get_iface(p, local, iface);
|
||||||
|
|
||||||
struct bfd_session *s = sl_alloc(p->session_slab);
|
struct bfd_session *s = sl_allocz(p->session_slab);
|
||||||
bzero(s, sizeof(struct bfd_session));
|
|
||||||
|
|
||||||
s->addr = addr;
|
s->addr = addr;
|
||||||
s->ifa = ifa;
|
s->ifa = ifa;
|
||||||
s->loc_id = bfd_get_free_id(p);
|
s->loc_id = bfd_get_free_id(p);
|
||||||
|
|
|
@ -1603,6 +1603,7 @@ bgp_get_prefix(struct bgp_channel *c, net_addr *net, u32 path_id)
|
||||||
|
|
||||||
px->buck_node.next = NULL;
|
px->buck_node.next = NULL;
|
||||||
px->buck_node.prev = NULL;
|
px->buck_node.prev = NULL;
|
||||||
|
px->next = NULL;
|
||||||
px->hash = hash;
|
px->hash = hash;
|
||||||
px->path_id = path_id;
|
px->path_id = path_id;
|
||||||
net_copy(px->net, net);
|
net_copy(px->net, net);
|
||||||
|
|
|
@ -2108,9 +2108,7 @@ ospf_hash_get(struct top_graph *f, u32 domain, u32 lsa, u32 rtr, u32 type)
|
||||||
if (e)
|
if (e)
|
||||||
return e;
|
return e;
|
||||||
|
|
||||||
e = sl_alloc(f->hash_slab);
|
e = sl_allocz(f->hash_slab);
|
||||||
bzero(e, sizeof(struct top_hash_entry));
|
|
||||||
|
|
||||||
e->color = OUTSPF;
|
e->color = OUTSPF;
|
||||||
e->dist = LSINFINITY;
|
e->dist = LSINFINITY;
|
||||||
e->lsa.type_raw = type;
|
e->lsa.type_raw = type;
|
||||||
|
|
Loading…
Reference in a new issue