From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <shemming@brocade.com>
Subject: [dpdk-dev] [PATCH 6/6] examples: remove unneeded casts
Date: Sat, 14 Feb 2015 09:59:10 -0500 [thread overview]
Message-ID: <1423925950-5201-6-git-send-email-shemming@brocade.com> (raw)
In-Reply-To: <1423925950-5201-1-git-send-email-shemming@brocade.com>
*alloc() routines return void * and therefore cast is not needed.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
examples/kni/main.c | 4 ++--
examples/l3fwd-acl/main.c | 4 ++--
examples/vhost/main.c | 7 ++++---
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/examples/kni/main.c b/examples/kni/main.c
index 45b96bc..2bff1e1 100644
--- a/examples/kni/main.c
+++ b/examples/kni/main.c
@@ -462,8 +462,8 @@ parse_config(const char *arg)
goto fail;
}
kni_port_params_array[port_id] =
- (struct kni_port_params*)rte_zmalloc("KNI_port_params",
- sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
+ rte_zmalloc("KNI_port_params",
+ sizeof(struct kni_port_params), RTE_CACHE_LINE_SIZE);
kni_port_params_array[port_id]->port_id = port_id;
kni_port_params_array[port_id]->lcore_rx =
(uint8_t)int_fld[i++];
diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c
index f1f7601..20e071a 100644
--- a/examples/l3fwd-acl/main.c
+++ b/examples/l3fwd-acl/main.c
@@ -1047,13 +1047,13 @@ add_rules(const char *rule_path,
fseek(fh, 0, SEEK_SET);
- acl_rules = (uint8_t *)calloc(acl_num, rule_size);
+ acl_rules = calloc(acl_num, rule_size);
if (NULL == acl_rules)
rte_exit(EXIT_FAILURE, "%s: failed to malloc memory\n",
__func__);
- route_rules = (uint8_t *)calloc(route_num, rule_size);
+ route_rules = calloc(route_num, rule_size);
if (NULL == route_rules)
rte_exit(EXIT_FAILURE, "%s: failed to malloc memory\n",
diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index 3a35359..a96b19f 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -2592,9 +2592,10 @@ new_device (struct virtio_net *dev)
}
- vdev->regions_hpa = (struct virtio_memory_regions_hpa *) rte_zmalloc("vhost hpa region",
- sizeof(struct virtio_memory_regions_hpa) * vdev->nregions_hpa,
- RTE_CACHE_LINE_SIZE);
+ vdev->regions_hpa = rte_calloc("vhost hpa region",
+ sizeof(struct virtio_memory_regions_hpa),
+ vdev->nregions_hpa,
+ RTE_CACHE_LINE_SIZE);
if (vdev->regions_hpa == NULL) {
RTE_LOG(ERR, VHOST_CONFIG, "Cannot allocate memory for hpa region\n");
rte_free(vdev);
--
2.1.4
next prev parent reply other threads:[~2015-02-14 14:59 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-14 14:59 [dpdk-dev] [PATCH 1/6] test: " Stephen Hemminger
2015-02-14 14:59 ` [dpdk-dev] [PATCH 2/6] vhost_xen: remove unnecessary cast Stephen Hemminger
2015-02-19 14:53 ` Bruce Richardson
2015-02-14 14:59 ` [dpdk-dev] [PATCH 3/6] bsd: remove useless assignments Stephen Hemminger
2015-02-16 11:31 ` Bruce Richardson
2015-02-14 14:59 ` [dpdk-dev] [PATCH 4/6] enic: eliminate useless cast Stephen Hemminger
2015-02-19 14:57 ` Bruce Richardson
2015-02-14 14:59 ` [dpdk-dev] [PATCH 5/6] eal: remove useless memset Stephen Hemminger
2015-02-19 14:58 ` Bruce Richardson
2015-02-14 14:59 ` Stephen Hemminger [this message]
2015-02-19 15:02 ` [dpdk-dev] [PATCH 6/6] examples: remove unneeded casts Bruce Richardson
2015-02-19 14:53 ` [dpdk-dev] [PATCH 1/6] test: " Bruce Richardson
2015-03-04 20:52 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1423925950-5201-6-git-send-email-shemming@brocade.com \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=shemming@brocade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).