summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2008-08-18 14:13:29 -0700
committerPaul Jakma <paul@quagga.net>2009-06-12 17:07:49 +0100
commit393deb9bd663361e6b110d579a8b1d4c22667068 (patch)
treee93ebf2f57bf92ff7a9cd045764b3cdbb99a07e5 /zebra
parent3453a7122c1d585ad789ed0f63deb90cc5e89fae (diff)
downloadquagga-393deb9bd663361e6b110d579a8b1d4c22667068.tar.bz2
quagga-393deb9bd663361e6b110d579a8b1d4c22667068.tar.xz
[cleanup] Convert XMALLOC/memset to XCALLOC
Simple conversion of XMALLOC/memset to XCALLOC
Diffstat (limited to 'zebra')
-rw-r--r--zebra/interface.c3
-rw-r--r--zebra/irdp_interface.c5
-rw-r--r--zebra/rtadv.c12
-rw-r--r--zebra/zebra_rib.c30
4 files changed, 14 insertions, 36 deletions
diff --git a/zebra/interface.c b/zebra/interface.c
index 184b42a0..9cbbf937 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/irdp_interface.c b/zebra/irdp_interface.c
index dd773402..b3a838b3 100644
--- a/zebra/irdp_interface.c
+++ b/zebra/irdp_interface.c
@@ -175,10 +175,7 @@ if_set_defaults(struct interface *ifp)
struct Adv *Adv_new (void)
{
- struct Adv *new;
- new = XMALLOC (MTYPE_TMP, sizeof (struct Adv));
- memset (new, 0, sizeof (struct Adv));
- return new;
+ return XCALLOC (MTYPE_TMP, sizeof (struct Adv));
}
static void
diff --git a/zebra/rtadv.c b/zebra/rtadv.c
index 4bdb83d5..e1fd0dc8 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));
}
static void
@@ -529,12 +526,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 90db932b..cc63dba0 100644
--- a/zebra/zebra_rib.c
+++ b/zebra/zebra_rib.c
@@ -209,8 +209,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;
@@ -224,8 +223,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);
@@ -239,8 +237,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)
@@ -257,8 +254,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)
@@ -276,8 +272,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;
@@ -292,8 +287,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);
@@ -309,8 +303,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;
@@ -326,8 +319,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);
@@ -2197,8 +2189,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;
@@ -2741,8 +2732,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;