]> git.puffer.fish Git - matthieu/frr.git/commitdiff
*: remove casts of XMALLOC / XCALLOC
authorQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 25 Feb 2019 20:30:31 +0000 (20:30 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Mon, 25 Feb 2019 23:00:46 +0000 (23:00 +0000)
No cast necessary for void *

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
18 files changed:
bgpd/bgp_advertise.c
bgpd/bgp_attr_evpn.c
bgpd/bgp_community.c
bgpd/bgp_ecommunity.c
bgpd/bgp_lcommunity.c
bgpd/bgp_updgrp_packet.c
bgpd/bgp_zebra.c
bgpd/bgpd.c
bgpd/rfapi/bgp_rfapi_cfg.c
bgpd/rfapi/rfapi_import.c
lib/filter.c
lib/prefix.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_lsa.c
ospf6d/ospf6_neighbor.c
ospf6d/ospf6_spf.c
ospfd/ospf_asbr.c
ospfd/ospf_zebra.c

index 93094b76d99c226cb63da62274263e077b420bbc..05eeeca1564ba7459f29fe39fca42a191b37d5ce 100644 (file)
@@ -45,8 +45,8 @@
    peer.  */
 struct bgp_advertise_attr *baa_new(void)
 {
-       return (struct bgp_advertise_attr *)XCALLOC(
-               MTYPE_BGP_ADVERTISE_ATTR, sizeof(struct bgp_advertise_attr));
+       return XCALLOC(MTYPE_BGP_ADVERTISE_ATTR,
+                      sizeof(struct bgp_advertise_attr));
 }
 
 static void baa_free(struct bgp_advertise_attr *baa)
@@ -84,8 +84,7 @@ bool baa_hash_cmp(const void *p1, const void *p2)
    information.  */
 struct bgp_advertise *bgp_advertise_new(void)
 {
-       return (struct bgp_advertise *)XCALLOC(MTYPE_BGP_ADVERTISE,
-                                              sizeof(struct bgp_advertise));
+       return XCALLOC(MTYPE_BGP_ADVERTISE, sizeof(struct bgp_advertise));
 }
 
 void bgp_advertise_free(struct bgp_advertise *adv)
index 3e9d05ad978c905a4d14005890530500e698b0eb..ca04ebf550aea08ecb439c31940d42cf6cd84732 100644 (file)
@@ -84,8 +84,8 @@ char *esi2str(struct eth_segment_id *id)
                return NULL;
 
        val = id->val;
-       ptr = (char *)XMALLOC(MTYPE_TMP,
-                             (ESI_LEN * 2 + ESI_LEN - 1 + 1) * sizeof(char));
+       ptr = XMALLOC(MTYPE_TMP,
+                     (ESI_LEN * 2 + ESI_LEN - 1 + 1) * sizeof(char));
 
        snprintf(ptr, (ESI_LEN * 2 + ESI_LEN - 1 + 1),
                 "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", val[0],
index 040fcabbe6b88cad25606287f4bf6f2c43eeef65..d3c5a8ef147c1e5d940ad36ae7688412af5065ac 100644 (file)
@@ -34,8 +34,7 @@ static struct hash *comhash;
 /* Allocate a new communities value.  */
 static struct community *community_new(void)
 {
-       return (struct community *)XCALLOC(MTYPE_COMMUNITY,
-                                          sizeof(struct community));
+       return XCALLOC(MTYPE_COMMUNITY, sizeof(struct community));
 }
 
 /* Free communities value.  */
index 7f586225723c9dc56a43722cfa41e6482dc98bcf..2a8d27ba24d62cd20ecde331339ecbc7fef0b80c 100644 (file)
@@ -48,8 +48,7 @@ static struct hash *ecomhash;
 /* Allocate a new ecommunities.  */
 struct ecommunity *ecommunity_new(void)
 {
-       return (struct ecommunity *)XCALLOC(MTYPE_ECOMMUNITY,
-                                           sizeof(struct ecommunity));
+       return XCALLOC(MTYPE_ECOMMUNITY, sizeof(struct ecommunity));
 }
 
 void ecommunity_strfree(char **s)
index fcf2a3b57cdfb65bfb1cdf0ec04311542f08ce4b..edc364ec277246f3d3bbb26df01b78579db1343d 100644 (file)
@@ -38,8 +38,7 @@ static struct hash *lcomhash;
 /* Allocate a new lcommunities.  */
 static struct lcommunity *lcommunity_new(void)
 {
-       return (struct lcommunity *)XCALLOC(MTYPE_LCOMMUNITY,
-                                           sizeof(struct lcommunity));
+       return XCALLOC(MTYPE_LCOMMUNITY, sizeof(struct lcommunity));
 }
 
 /* Allocate lcommunities.  */
index cbbf8b230290bfc96baa3ffa95b4599d355f12dd..66e306cba23d4bad8c504066e2df6dc32e7912a7 100644 (file)
@@ -69,8 +69,7 @@ struct bpacket *bpacket_alloc(void)
 {
        struct bpacket *pkt;
 
-       pkt = (struct bpacket *)XCALLOC(MTYPE_BGP_PACKET,
-                                       sizeof(struct bpacket));
+       pkt = XCALLOC(MTYPE_BGP_PACKET, sizeof(struct bpacket));
 
        return pkt;
 }
index 82a000392859aac01d000c50bf541b0f71adad5f..1df5f642b35829f070739f63356dea683f075b32 100644 (file)
@@ -1573,8 +1573,7 @@ struct bgp_redist *bgp_redist_add(struct bgp *bgp, afi_t afi, uint8_t type,
                bgp->redist[afi][type] = list_new();
 
        red_list = bgp->redist[afi][type];
-       red = (struct bgp_redist *)XCALLOC(MTYPE_BGP_REDIST,
-                                          sizeof(struct bgp_redist));
+       red = XCALLOC(MTYPE_BGP_REDIST, sizeof(struct bgp_redist));
        red->instance = instance;
 
        listnode_add(red_list, red);
index ab4aab8ae05bba8801f7bd470238544ed1c15cf2..8e397f0c0ebe8478ff6f7b609619ee35c10149e9 100644 (file)
@@ -2379,8 +2379,7 @@ static int peer_group_cmp(struct peer_group *g1, struct peer_group *g2)
 /* Peer group cofiguration. */
 static struct peer_group *peer_group_new(void)
 {
-       return (struct peer_group *)XCALLOC(MTYPE_PEER_GROUP,
-                                           sizeof(struct peer_group));
+       return XCALLOC(MTYPE_PEER_GROUP, sizeof(struct peer_group));
 }
 
 static void peer_group_free(struct peer_group *group)
index 53957d51b461af8b05975aa1f80d95fc2c553eee..2220f0ed9abf4fd758c981288f6ac93b8ee61b35 100644 (file)
@@ -3814,8 +3814,7 @@ struct rfapi_cfg *bgp_rfapi_cfg_new(struct rfapi_rfp_cfg *cfg)
        struct rfapi_cfg *h;
        afi_t afi;
 
-       h = (struct rfapi_cfg *)XCALLOC(MTYPE_RFAPI_CFG,
-                                       sizeof(struct rfapi_cfg));
+       h = XCALLOC(MTYPE_RFAPI_CFG, sizeof(struct rfapi_cfg));
        assert(h);
 
        h->nve_groups_sequential = list_new();
index 6b37073e0e7b0744596a766e5000c6fa0ff3f167..55775f384fad93446ca278512de9c49a57c16252 100644 (file)
@@ -4285,7 +4285,7 @@ struct rfapi *bgp_rfapi_new(struct bgp *bgp)
 
        assert(bgp->rfapi_cfg == NULL);
 
-       h = (struct rfapi *)XCALLOC(MTYPE_RFAPI, sizeof(struct rfapi));
+       h = XCALLOC(MTYPE_RFAPI, sizeof(struct rfapi));
 
        for (afi = AFI_IP; afi < AFI_MAX; afi++) {
                h->un[afi] = agg_table_init();
index 7df384f3b52b34215653e6c0589a54240a827100..276df4b4d7da3a3aa7a6d351a930c735ccc044db 100644 (file)
@@ -128,8 +128,7 @@ static struct access_master *access_master_get(afi_t afi)
 /* Allocate new filter structure. */
 static struct filter *filter_new(void)
 {
-       return (struct filter *)XCALLOC(MTYPE_ACCESS_FILTER,
-                                       sizeof(struct filter));
+       return XCALLOC(MTYPE_ACCESS_FILTER, sizeof(struct filter));
 }
 
 static void filter_free(struct filter *filter)
@@ -202,8 +201,7 @@ static int filter_match_zebra(struct filter *mfilter, const struct prefix *p)
 /* Allocate new access list structure. */
 static struct access_list *access_list_new(void)
 {
-       return (struct access_list *)XCALLOC(MTYPE_ACCESS_LIST,
-                                            sizeof(struct access_list));
+       return XCALLOC(MTYPE_ACCESS_LIST, sizeof(struct access_list));
 }
 
 /* Free allocated access_list. */
index 72ae0e635ce5ec84ed241d38dc7e0703448e679c..365a9ba38faf093c95027ea51025a52bcb9e682b 100644 (file)
@@ -1502,8 +1502,7 @@ char *prefix_mac2str(const struct ethaddr *mac, char *buf, int size)
        if (!mac)
                return NULL;
        if (!buf)
-               ptr = (char *)XMALLOC(MTYPE_TMP,
-                                     ETHER_ADDR_STRLEN * sizeof(char));
+               ptr = XMALLOC(MTYPE_TMP, ETHER_ADDR_STRLEN * sizeof(char));
        else {
                assert(size >= ETHER_ADDR_STRLEN);
                ptr = buf;
@@ -1584,8 +1583,7 @@ char *esi_to_str(const esi_t *esi, char *buf, int size)
        if (!esi)
                return NULL;
        if (!buf)
-               ptr = (char *)XMALLOC(MTYPE_TMP,
-                                     ESI_STR_LEN * sizeof(char));
+               ptr = XMALLOC(MTYPE_TMP, ESI_STR_LEN * sizeof(char));
        else {
                assert(size >= ESI_STR_LEN);
                ptr = buf;
index 83b9001fea9cdf3498337ad405d56e74d1e2fd6f..692c84ad08e7f7f82c144f4a4f3ce631fe222782 100644 (file)
@@ -177,8 +177,7 @@ struct ospf6_interface *ospf6_interface_create(struct interface *ifp)
        struct ospf6_interface *oi;
        unsigned int iobuflen;
 
-       oi = (struct ospf6_interface *)XCALLOC(MTYPE_OSPF6_IF,
-                                              sizeof(struct ospf6_interface));
+       oi = XCALLOC(MTYPE_OSPF6_IF, sizeof(struct ospf6_interface));
 
        oi->area = (struct ospf6_area *)NULL;
        oi->neighbor_list = list_new();
index 40b3522c3d7c94f033cdda8495544912623e79b1..9acbd09b1a958b2b1239f0403e80e857c619c520 100644 (file)
@@ -518,16 +518,14 @@ struct ospf6_lsa *ospf6_lsa_create(struct ospf6_lsa_header *header)
        lsa_size = ntohs(header->length); /* XXX vulnerable */
 
        /* allocate memory for this LSA */
-       new_header = (struct ospf6_lsa_header *)XMALLOC(MTYPE_OSPF6_LSA_HEADER,
-                                                       lsa_size);
+       new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, lsa_size);
 
        /* copy LSA from original header */
        memcpy(new_header, header, lsa_size);
 
        /* LSA information structure */
        /* allocate memory */
-       lsa = (struct ospf6_lsa *)XCALLOC(MTYPE_OSPF6_LSA,
-                                         sizeof(struct ospf6_lsa));
+       lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
 
        lsa->header = (struct ospf6_lsa_header *)new_header;
 
@@ -546,16 +544,15 @@ struct ospf6_lsa *ospf6_lsa_create_headeronly(struct ospf6_lsa_header *header)
        struct ospf6_lsa_header *new_header = NULL;
 
        /* allocate memory for this LSA */
-       new_header = (struct ospf6_lsa_header *)XMALLOC(
-               MTYPE_OSPF6_LSA_HEADER, sizeof(struct ospf6_lsa_header));
+       new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER,
+                            sizeof(struct ospf6_lsa_header));
 
        /* copy LSA from original header */
        memcpy(new_header, header, sizeof(struct ospf6_lsa_header));
 
        /* LSA information structure */
        /* allocate memory */
-       lsa = (struct ospf6_lsa *)XCALLOC(MTYPE_OSPF6_LSA,
-                                         sizeof(struct ospf6_lsa));
+       lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
 
        lsa->header = (struct ospf6_lsa_header *)new_header;
        SET_FLAG(lsa->flag, OSPF6_LSA_HEADERONLY);
index bb451c239e6c3ae584aebd58b126cdf417d423b9..8a9c2626b0bb71d7f7232f886b20c60ad88ee43c 100644 (file)
@@ -86,8 +86,7 @@ struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id,
        struct ospf6_neighbor *on;
        char buf[16];
 
-       on = (struct ospf6_neighbor *)XMALLOC(MTYPE_OSPF6_NEIGHBOR,
-                                             sizeof(struct ospf6_neighbor));
+       on = XMALLOC(MTYPE_OSPF6_NEIGHBOR, sizeof(struct ospf6_neighbor));
 
        memset(on, 0, sizeof(struct ospf6_neighbor));
        inet_ntop(AF_INET, &router_id, buf, sizeof(buf));
index 2d271c1dabbfac204ccf16b2e1d52ec6a725b424..d4f6f6f4aebb287b1fde2cf6b8839ed3a835d048 100644 (file)
@@ -107,8 +107,7 @@ static struct ospf6_vertex *ospf6_vertex_create(struct ospf6_lsa *lsa)
 {
        struct ospf6_vertex *v;
 
-       v = (struct ospf6_vertex *)XMALLOC(MTYPE_OSPF6_VERTEX,
-                                          sizeof(struct ospf6_vertex));
+       v = XMALLOC(MTYPE_OSPF6_VERTEX, sizeof(struct ospf6_vertex));
 
        /* type */
        if (ntohs(lsa->header->type) == OSPF6_LSTYPE_ROUTER) {
@@ -1016,8 +1015,7 @@ struct ospf6_lsa *ospf6_create_single_router_lsa(struct ospf6_area *area,
        new_header = XMALLOC(MTYPE_OSPF6_LSA_HEADER, total_lsa_length);
 
        /* LSA information structure */
-       lsa = (struct ospf6_lsa *)XCALLOC(MTYPE_OSPF6_LSA,
-                                         sizeof(struct ospf6_lsa));
+       lsa = XCALLOC(MTYPE_OSPF6_LSA, sizeof(struct ospf6_lsa));
 
        lsa->header = (struct ospf6_lsa_header *)new_header;
 
index ba2e04bf766b23b4f8daa2ad0e0b520fd6e3f9bd..ea919017d36c91394fee8e9614c12f6c719b9598 100644 (file)
@@ -79,8 +79,7 @@ struct external_info *ospf_external_info_new(uint8_t type,
 {
        struct external_info *new;
 
-       new = (struct external_info *)XCALLOC(MTYPE_OSPF_EXTERNAL_INFO,
-                                             sizeof(struct external_info));
+       new = XCALLOC(MTYPE_OSPF_EXTERNAL_INFO, sizeof(struct external_info));
        new->type = type;
        new->instance = instance;
 
index ea2c492e183e6c64ab90db27fa2d778052388c4d..4cbd817ad871b08e8164c738394ca425ba8fcb9e 100644 (file)
@@ -560,8 +560,7 @@ struct ospf_external *ospf_external_add(struct ospf *ospf, uint8_t type,
                ospf->external[type] = list_new();
 
        ext_list = ospf->external[type];
-       ext = (struct ospf_external *)XCALLOC(MTYPE_OSPF_EXTERNAL,
-                                             sizeof(struct ospf_external));
+       ext = XCALLOC(MTYPE_OSPF_EXTERNAL, sizeof(struct ospf_external));
        ext->instance = instance;
        EXTERNAL_INFO(ext) = route_table_init();
 
@@ -621,8 +620,7 @@ struct ospf_redist *ospf_redist_add(struct ospf *ospf, uint8_t type,
                ospf->redist[type] = list_new();
 
        red_list = ospf->redist[type];
-       red = (struct ospf_redist *)XCALLOC(MTYPE_OSPF_REDISTRIBUTE,
-                                           sizeof(struct ospf_redist));
+       red = XCALLOC(MTYPE_OSPF_REDISTRIBUTE, sizeof(struct ospf_redist));
        red->instance = instance;
        red->dmetric.type = -1;
        red->dmetric.value = -1;