0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-11-08 12:18:42 +00:00

Some minor sl_allocz() cleanups

This commit is contained in:
Ondrej Zajicek (work) 2020-11-24 03:21:44 +01:00
parent db2d29073a
commit c9ae81656f
5 changed files with 6 additions and 11 deletions

View File

@ -253,9 +253,7 @@ neigh_find(struct proto *p, ip_addr a, struct iface *iface, uint flags)
if ((scope < 0) && !(flags & NEF_STICKY))
return NULL;
n = sl_alloc(neigh_slab);
memset(n, 0, sizeof(neighbor));
n = sl_allocz(neigh_slab);
add_tail(&neigh_hash_table[h], &n->n);
add_tail((scope >= 0) ? &iface->neighbors : &sticky_neigh_list, &n->if_n);
n->addr = a;

View File

@ -135,7 +135,7 @@ rt_get_source(struct proto *p, u32 id)
if (src)
return src;
src = sl_alloc(rte_src_slab);
src = sl_allocz(rte_src_slab);
src->proto = p;
src->private_id = id;
src->global_id = idm_alloc(&src_ids);
@ -366,7 +366,7 @@ nexthop_copy(struct nexthop *o)
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->iface = o->iface;
n->next = NULL;

View File

@ -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_session *s = sl_alloc(p->session_slab);
bzero(s, sizeof(struct bfd_session));
struct bfd_session *s = sl_allocz(p->session_slab);
s->addr = addr;
s->ifa = ifa;
s->loc_id = bfd_get_free_id(p);

View File

@ -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.prev = NULL;
px->next = NULL;
px->hash = hash;
px->path_id = path_id;
net_copy(px->net, net);

View File

@ -2108,9 +2108,7 @@ ospf_hash_get(struct top_graph *f, u32 domain, u32 lsa, u32 rtr, u32 type)
if (e)
return e;
e = sl_alloc(f->hash_slab);
bzero(e, sizeof(struct top_hash_entry));
e = sl_allocz(f->hash_slab);
e->color = OUTSPF;
e->dist = LSINFINITY;
e->lsa.type_raw = type;