[cleanup] Convert XMALLOC/memset to XCALLOC
Simple conversion of XMALLOC/memset to XCALLOC
diff --git a/lib/distribute.c b/lib/distribute.c
index 906e3f6..242a225 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -38,12 +38,7 @@
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 3884051..672327e 100644
--- a/lib/hash.c
+++ b/lib/hash.c
@@ -32,9 +32,8 @@
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/if.c b/lib/if.c
index db590f5..de3f641 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -620,9 +620,7 @@
struct connected *
connected_new (void)
{
- struct connected *new = XMALLOC (MTYPE_CONNECTED, sizeof (struct connected));
- memset (new, 0, sizeof (struct connected));
- return new;
+ return XCALLOC (MTYPE_CONNECTED, sizeof (struct connected));
}
/* Free connected structure. */
diff --git a/lib/keychain.c b/lib/keychain.c
index 10928b1..af0a1d7 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -31,10 +31,7 @@
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 @@
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 a16e9e1..485a80b 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 @@
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 3750295..75419b1 100644
--- a/lib/sockunion.c
+++ b/lib/sockunion.c
@@ -180,8 +180,7 @@
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 10e6b5f..4a716a6 100644
--- a/lib/zclient.c
+++ b/lib/zclient.c
@@ -49,8 +49,7 @@
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);