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)
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)
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],
/* 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. */
/* 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)
/* 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. */
{
struct bpacket *pkt;
- pkt = (struct bpacket *)XCALLOC(MTYPE_BGP_PACKET,
- sizeof(struct bpacket));
+ pkt = XCALLOC(MTYPE_BGP_PACKET, sizeof(struct bpacket));
return pkt;
}
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);
/* 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)
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();
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();
/* 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)
/* 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. */
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;
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;
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();
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;
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);
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));
{
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) {
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;
{
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;
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();
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;