summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_aspath.c6
-rw-r--r--bgpd/bgp_attr.c3
-rw-r--r--bgpd/bgp_clist.c12
-rw-r--r--bgpd/bgp_filter.c12
-rw-r--r--bgpd/bgp_nexthop.c6
-rw-r--r--bgpd/bgp_route.c22
-rw-r--r--bgpd/bgp_table.c9
-rw-r--r--lib/distribute.c7
-rw-r--r--lib/hash.c3
-rw-r--r--lib/keychain.c10
-rw-r--r--lib/linklist.c12
-rw-r--r--lib/sockunion.c3
-rw-r--r--lib/zclient.c3
-rw-r--r--ospf6d/ospf6_top.c3
-rw-r--r--ospfd/ospf_api.c10
-rw-r--r--ospfd/ospf_apiserver.c3
-rw-r--r--ospfd/ospf_asbr.c3
-rw-r--r--ospfd/ospf_interface.c13
-rw-r--r--ospfd/ospf_lsa.c7
-rw-r--r--ospfd/ospf_neighbor.c3
-rw-r--r--ospfd/ospf_snmp.c6
-rw-r--r--ospfd/ospf_te.c6
-rw-r--r--ospfd/ospf_zebra.c5
-rw-r--r--ospfd/ospfd.c3
-rw-r--r--ripd/rip_interface.c3
-rw-r--r--ripd/rip_offset.c6
-rw-r--r--ripd/rip_peer.c6
-rw-r--r--ripd/ripd.c14
-rw-r--r--ripngd/ripng_peer.c6
-rw-r--r--ripngd/ripngd.c3
-rw-r--r--vtysh/vtysh_user.c5
-rw-r--r--zebra/interface.c3
-rw-r--r--zebra/rtadv.c12
-rw-r--r--zebra/zebra_rib.c30
34 files changed, 59 insertions, 199 deletions
diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c
index 006fc917..242bd8ee 100644
--- a/bgpd/bgp_aspath.c
+++ b/bgpd/bgp_aspath.c
@@ -322,11 +322,7 @@ assegment_normalise (struct assegment *head)
static struct aspath *
aspath_new (void)
{
- struct aspath *aspath;
-
- aspath = XMALLOC (MTYPE_AS_PATH, sizeof (struct aspath));
- memset (aspath, 0, sizeof (struct aspath));
- return aspath;
+ return XCALLOC (MTYPE_AS_PATH, sizeof (struct aspath));
}
/* Free AS path structure. */
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index e21f85d9..c52c776e 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -154,8 +154,7 @@ cluster_dup (struct cluster_list *cluster)
{
struct cluster_list *new;
- new = XMALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list));
- memset (new, 0, sizeof (struct cluster_list));
+ new = XCALLOC (MTYPE_CLUSTER, sizeof (struct cluster_list));
new->length = cluster->length;
if (cluster->length)
diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c
index a6ca1a46..6bf3b64a 100644
--- a/bgpd/bgp_clist.c
+++ b/bgpd/bgp_clist.c
@@ -51,11 +51,7 @@ community_list_master_lookup (struct community_list_handler *ch, int master)
static struct community_entry *
community_entry_new ()
{
- struct community_entry *new;
-
- new = XMALLOC (MTYPE_COMMUNITY_LIST_ENTRY, sizeof (struct community_entry));
- memset (new, 0, sizeof (struct community_entry));
- return new;
+ return XCALLOC (MTYPE_COMMUNITY_LIST_ENTRY, sizeof (struct community_entry));
}
/* Free community list entry. */
@@ -92,11 +88,7 @@ community_entry_free (struct community_entry *entry)
static struct community_list *
community_list_new ()
{
- struct community_list *new;
-
- new = XMALLOC (MTYPE_COMMUNITY_LIST, sizeof (struct community_list));
- memset (new, 0, sizeof (struct community_list));
- return new;
+ return XCALLOC (MTYPE_COMMUNITY_LIST, sizeof (struct community_list));
}
/* Free community-list. */
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index ef267e70..e4cf91af 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -99,11 +99,7 @@ static struct as_list_master as_list_master =
static struct as_filter *
as_filter_new ()
{
- struct as_filter *new;
-
- new = XMALLOC (MTYPE_AS_FILTER, sizeof (struct as_filter));
- memset (new, 0, sizeof (struct as_filter));
- return new;
+ return XCALLOC (MTYPE_AS_FILTER, sizeof (struct as_filter));
}
/* Free allocated AS filter. */
@@ -179,11 +175,7 @@ as_list_lookup (const char *name)
static struct as_list *
as_list_new ()
{
- struct as_list *new;
-
- new = XMALLOC (MTYPE_AS_LIST, sizeof (struct as_list));
- memset (new, 0, sizeof (struct as_list));
- return new;
+ return XCALLOC (MTYPE_AS_LIST, sizeof (struct as_list));
}
static void
diff --git a/bgpd/bgp_nexthop.c b/bgpd/bgp_nexthop.c
index 4dd5d946..a184dd4a 100644
--- a/bgpd/bgp_nexthop.c
+++ b/bgpd/bgp_nexthop.c
@@ -98,11 +98,7 @@ bnc_nexthop_free (struct bgp_nexthop_cache *bnc)
static struct bgp_nexthop_cache *
bnc_new ()
{
- struct bgp_nexthop_cache *new;
-
- new = XMALLOC (MTYPE_BGP_NEXTHOP_CACHE, sizeof (struct bgp_nexthop_cache));
- memset (new, 0, sizeof (struct bgp_nexthop_cache));
- return new;
+ return XCALLOC (MTYPE_BGP_NEXTHOP_CACHE, sizeof (struct bgp_nexthop_cache));
}
static void
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index e8b3b70d..db8e36d5 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -129,12 +129,7 @@ bgp_info_extra_get (struct bgp_info *ri)
static struct bgp_info *
bgp_info_new ()
{
- struct bgp_info *new;
-
- new = XMALLOC (MTYPE_BGP_ROUTE, sizeof (struct bgp_info));
- memset (new, 0, sizeof (struct bgp_info));
-
- return new;
+ return XCALLOC (MTYPE_BGP_ROUTE, sizeof (struct bgp_info));
}
/* Free bgp route information. */
@@ -3088,10 +3083,7 @@ bgp_nlri_sanity_check (struct peer *peer, int afi, u_char *pnt,
static struct bgp_static *
bgp_static_new ()
{
- struct bgp_static *new;
- new = XMALLOC (MTYPE_BGP_STATIC, sizeof (struct bgp_static));
- memset (new, 0, sizeof (struct bgp_static));
- return new;
+ return XCALLOC (MTYPE_BGP_STATIC, sizeof (struct bgp_static));
}
static void
@@ -4476,10 +4468,7 @@ struct bgp_aggregate
static struct bgp_aggregate *
bgp_aggregate_new ()
{
- struct bgp_aggregate *new;
- new = XMALLOC (MTYPE_BGP_AGGREGATE, sizeof (struct bgp_aggregate));
- memset (new, 0, sizeof (struct bgp_aggregate));
- return new;
+ return XCALLOC (MTYPE_BGP_AGGREGATE, sizeof (struct bgp_aggregate));
}
static void
@@ -10826,10 +10815,7 @@ struct bgp_distance
static struct bgp_distance *
bgp_distance_new ()
{
- struct bgp_distance *new;
- new = XMALLOC (MTYPE_BGP_DISTANCE, sizeof (struct bgp_distance));
- memset (new, 0, sizeof (struct bgp_distance));
- return new;
+ return XCALLOC (MTYPE_BGP_DISTANCE, sizeof (struct bgp_distance));
}
static void
diff --git a/bgpd/bgp_table.c b/bgpd/bgp_table.c
index 50cf8e8f..15630a24 100644
--- a/bgpd/bgp_table.c
+++ b/bgpd/bgp_table.c
@@ -36,8 +36,7 @@ bgp_table_init (afi_t afi, safi_t safi)
{
struct bgp_table *rt;
- rt = XMALLOC (MTYPE_BGP_TABLE, sizeof (struct bgp_table));
- memset (rt, 0, sizeof (struct bgp_table));
+ rt = XCALLOC (MTYPE_BGP_TABLE, sizeof (struct bgp_table));
rt->type = BGP_TABLE_MAIN;
rt->afi = afi;
@@ -56,11 +55,7 @@ bgp_table_finish (struct bgp_table **rt)
static struct bgp_node *
bgp_node_create ()
{
- struct bgp_node *rn;
-
- rn = (struct bgp_node *) XMALLOC (MTYPE_BGP_NODE, sizeof (struct bgp_node));
- memset (rn, 0, sizeof (struct bgp_node));
- return rn;
+ return XCALLOC (MTYPE_BGP_NODE, sizeof (struct bgp_node));
}
/* Allocate new route node with prefix set. */
diff --git a/lib/distribute.c b/lib/distribute.c
index 906e3f6d..242a225c 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -38,12 +38,7 @@ void (*distribute_delete_hook) (struct distribute *);
static struct distribute *
distribute_new (void)
{
- struct distribute *new;
-
- new = XMALLOC (MTYPE_DISTRIBUTE, sizeof (struct distribute));
- memset (new, 0, sizeof (struct distribute));
-
- return new;
+ return XCALLOC (MTYPE_DISTRIBUTE, sizeof (struct distribute));
}
/* Free distribute object. */
diff --git a/lib/hash.c b/lib/hash.c
index 3884051f..f705e5dd 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -32,9 +32,8 @@ hash_create_size (unsigned int size, unsigned int (*hash_key) (void *),
struct hash *hash;
hash = XMALLOC (MTYPE_HASH, sizeof (struct hash));
- hash->index = XMALLOC (MTYPE_HASH_INDEX,
+ hash->index = XCALLOC (MTYPE_HASH_INDEX,
sizeof (struct hash_backet *) * size);
- memset (hash->index, 0, sizeof (struct hash_backet *) * size);
hash->size = size;
hash->hash_key = hash_key;
hash->hash_cmp = hash_cmp;
diff --git a/lib/keychain.c b/lib/keychain.c
index 2dec87bc..6719cebf 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -31,10 +31,7 @@ struct list *keychain_list;
static struct keychain *
keychain_new (void)
{
- struct keychain *new;
- new = XMALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain));
- memset (new, 0, sizeof (struct keychain));
- return new;
+ return XCALLOC (MTYPE_KEYCHAIN, sizeof (struct keychain));
}
static void
@@ -46,10 +43,7 @@ keychain_free (struct keychain *keychain)
static struct key *
key_new (void)
{
- struct key *new;
- new = XMALLOC (MTYPE_KEY, sizeof (struct key));
- memset (new, 0, sizeof (struct key));
- return new;
+ return XCALLOC (MTYPE_KEY, sizeof (struct key));
}
static void
diff --git a/lib/linklist.c b/lib/linklist.c
index a16e9e18..485a80be 100644
--- a/lib/linklist.c
+++ b/lib/linklist.c
@@ -28,11 +28,7 @@
struct list *
list_new (void)
{
- struct list *new;
-
- new = XMALLOC (MTYPE_LINK_LIST, sizeof (struct list));
- memset (new, 0, sizeof (struct list));
- return new;
+ return XCALLOC (MTYPE_LINK_LIST, sizeof (struct list));
}
/* Free list. */
@@ -46,11 +42,7 @@ list_free (struct list *l)
static struct listnode *
listnode_new (void)
{
- struct listnode *node;
-
- node = XMALLOC (MTYPE_LINK_NODE, sizeof (struct listnode));
- memset (node, 0, sizeof (struct listnode));
- return node;
+ return XCALLOC (MTYPE_LINK_NODE, sizeof (struct listnode));
}
/* Free listnode. */
diff --git a/lib/sockunion.c b/lib/sockunion.c
index cfd3bf9a..1ae092bd 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -180,8 +180,7 @@ sockunion_str2su (const char *str)
int ret;
union sockunion *su;
- su = XMALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
- memset (su, 0, sizeof (union sockunion));
+ su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
ret = inet_pton (AF_INET, str, &su->sin.sin_addr);
if (ret > 0) /* Valid IPv4 address format. */
diff --git a/lib/zclient.c b/lib/zclient.c
index 10e6b5fd..4a716a66 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -49,8 +49,7 @@ struct zclient *
zclient_new ()
{
struct zclient *zclient;
- zclient = XMALLOC (MTYPE_ZCLIENT, sizeof (struct zclient));
- memset (zclient, 0, sizeof (struct zclient));
+ zclient = XCALLOC (MTYPE_ZCLIENT, sizeof (struct zclient));
zclient->ibuf = stream_new (ZEBRA_MAX_PACKET_SIZ);
zclient->obuf = stream_new (ZEBRA_MAX_PACKET_SIZ);
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 1e0a3e2d..deaa7ff5 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -114,8 +114,7 @@ ospf6_create ()
{
struct ospf6 *o;
- o = XMALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6));
- memset (o, 0, sizeof (struct ospf6));
+ o = XCALLOC (MTYPE_OSPF6_TOP, sizeof (struct ospf6));
/* initialize */
gettimeofday (&o->starttime, (struct timezone *) NULL);
diff --git a/ospfd/ospf_api.c b/ospfd/ospf_api.c
index b6c8bc90..fc3b51dd 100644
--- a/ospfd/ospf_api.c
+++ b/ospfd/ospf_api.c
@@ -99,8 +99,7 @@ msg_new (u_char msgtype, void *msgbody, u_int32_t seqnum, u_int16_t msglen)
{
struct msg *new;
- new = XMALLOC (MTYPE_OSPF_API_MSG, sizeof (struct msg));
- memset (new, 0, sizeof (struct msg));
+ new = XCALLOC (MTYPE_OSPF_API_MSG, sizeof (struct msg));
new->hdr.version = OSPF_API_VERSION;
new->hdr.msgtype = msgtype;
@@ -271,12 +270,7 @@ msg_get_seq (struct msg *msg)
struct msg_fifo *
msg_fifo_new ()
{
- struct msg_fifo *new;
-
- new = XMALLOC (MTYPE_OSPF_API_FIFO, sizeof (struct msg_fifo));
- memset (new, 0, sizeof (struct msg_fifo));
-
- return new;
+ return XCALLOC (MTYPE_OSPF_API_FIFO, sizeof (struct msg_fifo));
}
/* Add new message to fifo. */
diff --git a/ospfd/ospf_apiserver.c b/ospfd/ospf_apiserver.c
index dac4c93f..15fd2e5f 100644
--- a/ospfd/ospf_apiserver.c
+++ b/ospfd/ospf_apiserver.c
@@ -937,8 +937,7 @@ ospf_apiserver_register_opaque_type (struct ospf_apiserver *apiserv,
type. */
regtype =
- XMALLOC (MTYPE_OSPF_APISERVER, sizeof (struct registered_opaque_type));
- memset (regtype, 0, sizeof (struct registered_opaque_type));
+ XCALLOC (MTYPE_OSPF_APISERVER, sizeof (struct registered_opaque_type));
regtype->lsa_type = lsa_type;
regtype->opaque_type = opaque_type;
diff --git a/ospfd/ospf_asbr.c b/ospfd/ospf_asbr.c
index a4826237..6f1b0b06 100644
--- a/ospfd/ospf_asbr.c
+++ b/ospfd/ospf_asbr.c
@@ -104,8 +104,7 @@ ospf_external_info_new (u_char type)
struct external_info *new;
new = (struct external_info *)
- XMALLOC (MTYPE_OSPF_EXTERNAL_INFO, sizeof (struct external_info));
- memset (new, 0, sizeof (struct external_info));
+ XCALLOC (MTYPE_OSPF_EXTERNAL_INFO, sizeof (struct external_info));
new->type = type;
ospf_reset_route_map_set_values (&new->route_map_set);
diff --git a/ospfd/ospf_interface.c b/ospfd/ospf_interface.c
index 63681429..5d4f415f 100644
--- a/ospfd/ospf_interface.c
+++ b/ospfd/ospf_interface.c
@@ -638,8 +638,7 @@ ospf_if_new_hook (struct interface *ifp)
{
int rc = 0;
- ifp->info = XMALLOC (MTYPE_OSPF_IF_INFO, sizeof (struct ospf_if_info));
- memset (ifp->info, 0, sizeof (struct ospf_if_info));
+ ifp->info = XCALLOC (MTYPE_OSPF_IF_INFO, sizeof (struct ospf_if_info));
IF_OIFS (ifp) = route_table_init ();
IF_OIFS_PARAMS (ifp) = route_table_init ();
@@ -814,8 +813,7 @@ ospf_vl_data_new (struct ospf_area *area, struct in_addr vl_peer)
{
struct ospf_vl_data *vl_data;
- vl_data = XMALLOC (MTYPE_OSPF_VL_DATA, sizeof (struct ospf_vl_data));
- memset (vl_data, 0, sizeof (struct ospf_vl_data));
+ vl_data = XCALLOC (MTYPE_OSPF_VL_DATA, sizeof (struct ospf_vl_data));
vl_data->vl_peer.s_addr = vl_peer.s_addr;
vl_data->vl_area_id = area->area_id;
@@ -1180,12 +1178,7 @@ ospf_vls_in_area (struct ospf_area *area)
struct crypt_key *
ospf_crypt_key_new ()
{
- struct crypt_key *ck;
-
- ck = XMALLOC (MTYPE_OSPF_CRYPT_KEY, sizeof (struct crypt_key));
- memset (ck, 0, sizeof (struct crypt_key));
-
- return ck;
+ return XCALLOC (MTYPE_OSPF_CRYPT_KEY, sizeof (struct crypt_key));
}
void
diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c
index fccae82f..aff395af 100644
--- a/ospfd/ospf_lsa.c
+++ b/ospfd/ospf_lsa.c
@@ -326,12 +326,7 @@ ospf_lsa_discard (struct ospf_lsa *lsa)
struct lsa_header *
ospf_lsa_data_new (size_t size)
{
- struct lsa_header *new;
-
- new = (struct lsa_header *) XMALLOC (MTYPE_OSPF_LSA_DATA, size);
- memset (new, 0, size);
-
- return new;
+ return XCALLOC (MTYPE_OSPF_LSA_DATA, size);
}
/* Duplicate LSA data. */
diff --git a/ospfd/ospf_neighbor.c b/ospfd/ospf_neighbor.c
index 843e93f6..967ca15d 100644
--- a/ospfd/ospf_neighbor.c
+++ b/ospfd/ospf_neighbor.c
@@ -69,8 +69,7 @@ ospf_nbr_new (struct ospf_interface *oi)
struct ospf_neighbor *nbr;
/* Allcate new neighbor. */
- nbr = XMALLOC (MTYPE_OSPF_NEIGHBOR, sizeof (struct ospf_neighbor));
- memset (nbr, 0, sizeof (struct ospf_neighbor));
+ nbr = XCALLOC (MTYPE_OSPF_NEIGHBOR, sizeof (struct ospf_neighbor));
/* Relate neighbor to the interface. */
nbr->oi = oi;
diff --git a/ospfd/ospf_snmp.c b/ospfd/ospf_snmp.c
index e76b39b0..a16da41b 100644
--- a/ospfd/ospf_snmp.c
+++ b/ospfd/ospf_snmp.c
@@ -1389,11 +1389,7 @@ struct ospf_snmp_if
struct ospf_snmp_if *
ospf_snmp_if_new ()
{
- struct ospf_snmp_if *osif;
-
- osif = XMALLOC (0, sizeof (struct ospf_snmp_if));
- memset (osif, 0, sizeof (struct ospf_snmp_if));
- return osif;
+ return XCALLOC (0, sizeof (struct ospf_snmp_if));
}
void
diff --git a/ospfd/ospf_te.c b/ospfd/ospf_te.c
index a3ebe62e..c5ec0ad8 100644
--- a/ospfd/ospf_te.c
+++ b/ospfd/ospf_te.c
@@ -561,13 +561,13 @@ ospf_mpls_te_new_if (struct interface *ifp)
goto out;
}
- if ((new = XMALLOC (MTYPE_OSPF_MPLS_TE_LINKPARAMS,
- sizeof (struct mpls_te_link))) == NULL)
+ new = XCALLOC (MTYPE_OSPF_MPLS_TE_LINKPARAMS,
+ sizeof (struct mpls_te_link));
+ if (new == NULL)
{
zlog_warn ("ospf_mpls_te_new_if: XMALLOC: %s", safe_strerror (errno));
goto out;
}
- memset (new, 0, sizeof (struct mpls_te_link));
new->area = NULL;
new->flags = 0;
diff --git a/ospfd/ospf_zebra.c b/ospfd/ospf_zebra.c
index c627afb2..3afbcbb7 100644
--- a/ospfd/ospf_zebra.c
+++ b/ospfd/ospf_zebra.c
@@ -1126,10 +1126,7 @@ ospf_prefix_list_update (struct prefix_list *plist)
static struct ospf_distance *
ospf_distance_new (void)
{
- struct ospf_distance *new;
- new = XMALLOC (MTYPE_OSPF_DISTANCE, sizeof (struct ospf_distance));
- memset (new, 0, sizeof (struct ospf_distance));
- return new;
+ return XCALLOC (MTYPE_OSPF_DISTANCE, sizeof (struct ospf_distance));
}
static void
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 448f218e..d352a056 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -1385,9 +1385,8 @@ ospf_nbr_nbma_new (void)
{
struct ospf_nbr_nbma *nbr_nbma;
- nbr_nbma = XMALLOC (MTYPE_OSPF_NEIGHBOR_STATIC,
+ nbr_nbma = XCALLOC (MTYPE_OSPF_NEIGHBOR_STATIC,
sizeof (struct ospf_nbr_nbma));
- memset (nbr_nbma, 0, sizeof (struct ospf_nbr_nbma));
nbr_nbma->priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
nbr_nbma->v_poll = OSPF_POLL_INTERVAL_DEFAULT;
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 552217a5..131898c2 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -119,8 +119,7 @@ rip_interface_new (void)
{
struct rip_interface *ri;
- ri = XMALLOC (MTYPE_RIP_INTERFACE, sizeof (struct rip_interface));
- memset (ri, 0, sizeof (struct rip_interface));
+ ri = XCALLOC (MTYPE_RIP_INTERFACE, sizeof (struct rip_interface));
/* Default authentication type is simple password for Cisco
compatibility. */
diff --git a/ripd/rip_offset.c b/ripd/rip_offset.c
index e7d71f6c..0155f90e 100644
--- a/ripd/rip_offset.c
+++ b/ripd/rip_offset.c
@@ -63,11 +63,7 @@ strcmp_safe (const char *s1, const char *s2)
static struct rip_offset_list *
rip_offset_list_new (void)
{
- struct rip_offset_list *new;
-
- new = XMALLOC (MTYPE_RIP_OFFSET_LIST, sizeof (struct rip_offset_list));
- memset (new, 0, sizeof (struct rip_offset_list));
- return new;
+ return XCALLOC (MTYPE_RIP_OFFSET_LIST, sizeof (struct rip_offset_list));
}
static void
diff --git a/ripd/rip_peer.c b/ripd/rip_peer.c
index e0617890..fd912eba 100644
--- a/ripd/rip_peer.c
+++ b/ripd/rip_peer.c
@@ -36,11 +36,7 @@ struct list *peer_list;
static struct rip_peer *
rip_peer_new (void)
{
- struct rip_peer *new;
-
- new = XMALLOC (MTYPE_RIP_PEER, sizeof (struct rip_peer));
- memset (new, 0, sizeof (struct rip_peer));
- return new;
+ return XCALLOC (MTYPE_RIP_PEER, sizeof (struct rip_peer));
}
static void
diff --git a/ripd/ripd.c b/ripd/ripd.c
index 2b33c338..fc8ce1b8 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -112,11 +112,7 @@ rip_route_rte (struct rip_info *rinfo)
static struct rip_info *
rip_info_new ()
{
- struct rip_info *new;
-
- new = XMALLOC (MTYPE_RIP_INFO, sizeof (struct rip_info));
- memset (new, 0, sizeof (struct rip_info));
- return new;
+ return XCALLOC (MTYPE_RIP_INFO, sizeof (struct rip_info));
}
void
@@ -2697,8 +2693,7 @@ rip_redistribute_withdraw (int type)
static int
rip_create (void)
{
- rip = XMALLOC (MTYPE_RIP, sizeof (struct rip));
- memset (rip, 0, sizeof (struct rip));
+ rip = XCALLOC (MTYPE_RIP, sizeof (struct rip));
/* Set initial value. */
rip->version_send = RI_RIP_VERSION_2;
@@ -3119,10 +3114,7 @@ struct rip_distance
static struct rip_distance *
rip_distance_new (void)
{
- struct rip_distance *new;
- new = XMALLOC (MTYPE_RIP_DISTANCE, sizeof (struct rip_distance));
- memset (new, 0, sizeof (struct rip_distance));
- return new;
+ return XCALLOC (MTYPE_RIP_DISTANCE, sizeof (struct rip_distance));
}
static void
diff --git a/ripngd/ripng_peer.c b/ripngd/ripng_peer.c
index 34f5ac6c..0438b4bf 100644
--- a/ripngd/ripng_peer.c
+++ b/ripngd/ripng_peer.c
@@ -42,11 +42,7 @@ struct list *peer_list;
struct ripng_peer *
ripng_peer_new ()
{
- struct ripng_peer *new;
-
- new = XMALLOC (MTYPE_RIPNG_PEER, sizeof (struct ripng_peer));
- memset (new, 0, sizeof (struct ripng_peer));
- return new;
+ return XCALLOC (MTYPE_RIPNG_PEER, sizeof (struct ripng_peer));
}
void
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 43e1bf4d..9bf40dff 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -1820,8 +1820,7 @@ ripng_create ()
assert (ripng == NULL);
/* Allocaste RIPng instance. */
- ripng = XMALLOC (MTYPE_RIPNG, sizeof (struct ripng));
- memset (ripng, 0, sizeof (struct ripng));
+ ripng = XCALLOC (MTYPE_RIPNG, sizeof (struct ripng));
/* Default version and timer values. */
ripng->version = RIPNG_V1;
diff --git a/vtysh/vtysh_user.c b/vtysh/vtysh_user.c
index e3015056..58676c10 100644
--- a/vtysh/vtysh_user.c
+++ b/vtysh/vtysh_user.c
@@ -101,10 +101,7 @@ struct list *userlist;
struct vtysh_user *
user_new ()
{
- struct vtysh_user *user;
- user = XMALLOC (0, sizeof (struct vtysh_user));
- memset (user, 0, sizeof (struct vtysh_user));
- return user;
+ return XCALLOC (0, sizeof (struct vtysh_user));
}
void
diff --git a/zebra/interface.c b/zebra/interface.c
index ce506056..74c977a9 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -48,8 +48,7 @@ if_zebra_new_hook (struct interface *ifp)
{
struct zebra_if *zebra_if;
- zebra_if = XMALLOC (MTYPE_TMP, sizeof (struct zebra_if));
- memset (zebra_if, 0, sizeof (struct zebra_if));
+ zebra_if = XCALLOC (MTYPE_TMP, sizeof (struct zebra_if));
zebra_if->multicast = IF_ZEBRA_MULTICAST_UNSPEC;
zebra_if->shutdown = IF_ZEBRA_SHUTDOWN_UNSPEC;
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 0097e28f..86956ed7 100644
--- a/zebra/rtadv.c
+++ b/zebra/rtadv.c
@@ -84,10 +84,7 @@ struct rtadv *rtadv = NULL;
static struct rtadv *
rtadv_new (void)
{
- struct rtadv *new;
- new = XMALLOC (MTYPE_TMP, sizeof (struct rtadv));
- memset (new, 0, sizeof (struct rtadv));
- return new;
+ return XCALLOC (MTYPE_TMP, sizeof (struct rtadv));
}
#if 0
@@ -531,12 +528,7 @@ rtadv_make_socket (void)
static struct rtadv_prefix *
rtadv_prefix_new ()
{
- struct rtadv_prefix *new;
-
- new = XMALLOC (MTYPE_RTADV_PREFIX, sizeof (struct rtadv_prefix));
- memset (new, 0, sizeof (struct rtadv_prefix));
-
- return new;
+ return XCALLOC (MTYPE_RTADV_PREFIX, sizeof (struct rtadv_prefix));
}
static void
diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c
index 580880b3..44113f0e 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -217,8 +217,7 @@ nexthop_ifindex_add (struct rib *rib, unsigned int ifindex,
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IFINDEX;
nexthop->ifindex = ifindex;
if (src)
@@ -234,8 +233,7 @@ nexthop_ifname_add (struct rib *rib, char *ifname)
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IFNAME;
nexthop->ifname = XSTRDUP (0, ifname);
@@ -249,8 +247,7 @@ nexthop_ipv4_add (struct rib *rib, struct in_addr *ipv4, struct in_addr *src)
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IPV4;
nexthop->gate.ipv4 = *ipv4;
if (src)
@@ -267,8 +264,7 @@ nexthop_ipv4_ifindex_add (struct rib *rib, struct in_addr *ipv4,
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IPV4_IFINDEX;
nexthop->gate.ipv4 = *ipv4;
if (src)
@@ -286,8 +282,7 @@ nexthop_ipv6_add (struct rib *rib, struct in6_addr *ipv6)
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IPV6;
nexthop->gate.ipv6 = *ipv6;
@@ -302,8 +297,7 @@ nexthop_ipv6_ifname_add (struct rib *rib, struct in6_addr *ipv6,
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IPV6_IFNAME;
nexthop->gate.ipv6 = *ipv6;
nexthop->ifname = XSTRDUP (0, ifname);
@@ -319,8 +313,7 @@ nexthop_ipv6_ifindex_add (struct rib *rib, struct in6_addr *ipv6,
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_IPV6_IFINDEX;
nexthop->gate.ipv6 = *ipv6;
nexthop->ifindex = ifindex;
@@ -336,8 +329,7 @@ nexthop_blackhole_add (struct rib *rib)
{
struct nexthop *nexthop;
- nexthop = XMALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
- memset (nexthop, 0, sizeof (struct nexthop));
+ nexthop = XCALLOC (MTYPE_NEXTHOP, sizeof (struct nexthop));
nexthop->type = NEXTHOP_TYPE_BLACKHOLE;
SET_FLAG (rib->flags, ZEBRA_FLAG_BLACKHOLE);
@@ -2295,8 +2287,7 @@ static_add_ipv4 (struct prefix *p, struct in_addr *gate, const char *ifname,
static_delete_ipv4 (p, gate, ifname, update->distance, vrf_id);
/* Make new static route structure. */
- si = XMALLOC (MTYPE_STATIC_IPV4, sizeof (struct static_ipv4));
- memset (si, 0, sizeof (struct static_ipv4));
+ si = XCALLOC (MTYPE_STATIC_IPV4, sizeof (struct static_ipv4));
si->type = type;
si->distance = distance;
@@ -2851,8 +2842,7 @@ static_add_ipv6 (struct prefix *p, u_char type, struct in6_addr *gate,
}
/* Make new static route structure. */
- si = XMALLOC (MTYPE_STATIC_IPV6, sizeof (struct static_ipv6));
- memset (si, 0, sizeof (struct static_ipv6));
+ si = XCALLOC (MTYPE_STATIC_IPV6, sizeof (struct static_ipv6));
si->type = type;
si->distance = distance;