From 393deb9bd663361e6b110d579a8b1d4c22667068 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Mon, 18 Aug 2008 14:13:29 -0700 Subject: [cleanup] Convert XMALLOC/memset to XCALLOC Simple conversion of XMALLOC/memset to XCALLOC --- ospf6d/ospf6_asbr.c | 3 +-- ospf6d/ospf6_interface.c | 6 ++---- ospf6d/ospf6_lsa.c | 6 ++---- ospf6d/ospf6_top.c | 3 +-- 4 files changed, 6 insertions(+), 12 deletions(-) (limited to 'ospf6d') diff --git a/ospf6d/ospf6_asbr.c b/ospf6d/ospf6_asbr.c index 37b912b4..685b147c 100644 --- a/ospf6d/ospf6_asbr.c +++ b/ospf6d/ospf6_asbr.c @@ -504,8 +504,7 @@ ospf6_asbr_redistribute_add (int type, int ifindex, struct prefix *prefix, memcpy (&route->prefix, prefix, sizeof (struct prefix)); info = (struct ospf6_external_info *) - XMALLOC (MTYPE_OSPF6_EXTERNAL_INFO, sizeof (struct ospf6_external_info)); - memset (info, 0, sizeof (struct ospf6_external_info)); + XCALLOC (MTYPE_OSPF6_EXTERNAL_INFO, sizeof (struct ospf6_external_info)); route->route_option = info; info->id = ospf6->external_id++; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 8d9a7f01..42152084 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -96,11 +96,9 @@ ospf6_interface_create (struct interface *ifp) unsigned int iobuflen; oi = (struct ospf6_interface *) - XMALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface)); + XCALLOC (MTYPE_OSPF6_IF, sizeof (struct ospf6_interface)); - if (oi) - memset (oi, 0, sizeof (struct ospf6_interface)); - else + if (!oi) { zlog_err ("Can't malloc ospf6_interface for ifindex %d", ifp->ifindex); return (struct ospf6_interface *) NULL; diff --git a/ospf6d/ospf6_lsa.c b/ospf6d/ospf6_lsa.c index 87df7418..e8290b63 100644 --- a/ospf6d/ospf6_lsa.c +++ b/ospf6d/ospf6_lsa.c @@ -468,8 +468,7 @@ ospf6_lsa_create (struct ospf6_lsa_header *header) /* LSA information structure */ /* allocate memory */ lsa = (struct ospf6_lsa *) - XMALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); - memset (lsa, 0, sizeof (struct ospf6_lsa)); + XCALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); lsa->header = (struct ospf6_lsa_header *) new_header; @@ -498,8 +497,7 @@ ospf6_lsa_create_headeronly (struct ospf6_lsa_header *header) /* LSA information structure */ /* allocate memory */ lsa = (struct ospf6_lsa *) - XMALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); - memset (lsa, 0, sizeof (struct ospf6_lsa)); + XCALLOC (MTYPE_OSPF6_LSA, sizeof (struct ospf6_lsa)); lsa->header = (struct ospf6_lsa_header *) new_header; SET_FLAG (lsa->flag, OSPF6_LSA_HEADERONLY); diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index f59b6f95..d45d1321 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -114,8 +114,7 @@ ospf6_create (void) { 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); -- cgit v1.2.1