* [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast
@ 2018-01-15 7:55 Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 1/5] lib/librte_lpm: " Zhiyong Yang
` (5 more replies)
0 siblings, 6 replies; 8+ messages in thread
From: Zhiyong Yang @ 2018-01-15 7:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas
void * pointer can be assigned to any data type pointer. Unnecessary cast
can be removed in order to keep code clearer.
Zhiyong Yang (5):
lib/librte_lpm: remove unnecessary void * pointer cast
lib/librte_efd: remove unnecessary void * pointer cast using
rte_zmalloc_socket
lib/librte_hash: remove unnecessary void * pointer cast using
rte_zmalloc_socket
lib/librte_member: remove unnecessary void * pointer cast
lib/librte_pipeline: remove unnecessary void * pointer cast using
rte_zmalloc_socket
lib/librte_efd/rte_efd.c | 8 ++++----
lib/librte_hash/rte_fbk_hash.c | 2 +-
lib/librte_lpm/rte_lpm.c | 24 ++++++++++++------------
lib/librte_lpm/rte_lpm6.c | 4 ++--
lib/librte_member/rte_member.c | 4 ++--
lib/librte_pipeline/rte_pipeline.c | 2 +-
6 files changed, 22 insertions(+), 22 deletions(-)
--
2.13.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 1/5] lib/librte_lpm: remove unnecessary void * pointer cast
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
@ 2018-01-15 7:55 ` Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 2/5] lib/librte_efd: remove unnecessary void * pointer cast using rte_zmalloc_socket Zhiyong Yang
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Zhiyong Yang @ 2018-01-15 7:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
void * pointer can be assigned to any data type pointer. Unnecessary cast
can be removed in order to keep code clearer.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_lpm/rte_lpm.c | 24 ++++++++++++------------
lib/librte_lpm/rte_lpm6.c | 4 ++--
2 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c
index 5ba595e22..d464dbda9 100644
--- a/lib/librte_lpm/rte_lpm.c
+++ b/lib/librte_lpm/rte_lpm.c
@@ -99,7 +99,7 @@ rte_lpm_find_existing_v20(const char *name)
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, lpm_list, next) {
- l = (struct rte_lpm_v20 *) te->data;
+ l = te->data;
if (strncmp(name, l->name, RTE_LPM_NAMESIZE) == 0)
break;
}
@@ -125,7 +125,7 @@ rte_lpm_find_existing_v1604(const char *name)
rte_rwlock_read_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, lpm_list, next) {
- l = (struct rte_lpm *) te->data;
+ l = te->data;
if (strncmp(name, l->name, RTE_LPM_NAMESIZE) == 0)
break;
}
@@ -174,11 +174,11 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules,
/* guarantee there's no existing */
TAILQ_FOREACH(te, lpm_list, next) {
- lpm = (struct rte_lpm_v20 *) te->data;
+ lpm = te->data;
if (strncmp(name, lpm->name, RTE_LPM_NAMESIZE) == 0)
break;
}
- lpm = NULL;
+
if (te != NULL) {
rte_errno = EEXIST;
goto exit;
@@ -193,7 +193,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules,
}
/* Allocate memory to store the LPM data structures. */
- lpm = (struct rte_lpm_v20 *)rte_zmalloc_socket(mem_name, mem_size,
+ lpm = rte_zmalloc_socket(mem_name, mem_size,
RTE_CACHE_LINE_SIZE, socket_id);
if (lpm == NULL) {
RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
@@ -206,7 +206,7 @@ rte_lpm_create_v20(const char *name, int socket_id, int max_rules,
lpm->max_rules = max_rules;
snprintf(lpm->name, sizeof(lpm->name), "%s", name);
- te->data = (void *) lpm;
+ te->data = lpm;
TAILQ_INSERT_TAIL(lpm_list, te, next);
@@ -250,11 +250,11 @@ rte_lpm_create_v1604(const char *name, int socket_id,
/* guarantee there's no existing */
TAILQ_FOREACH(te, lpm_list, next) {
- lpm = (struct rte_lpm *) te->data;
+ lpm = te->data;
if (strncmp(name, lpm->name, RTE_LPM_NAMESIZE) == 0)
break;
}
- lpm = NULL;
+
if (te != NULL) {
rte_errno = EEXIST;
goto exit;
@@ -269,7 +269,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
}
/* Allocate memory to store the LPM data structures. */
- lpm = (struct rte_lpm *)rte_zmalloc_socket(mem_name, mem_size,
+ lpm = rte_zmalloc_socket(mem_name, mem_size,
RTE_CACHE_LINE_SIZE, socket_id);
if (lpm == NULL) {
RTE_LOG(ERR, LPM, "LPM memory allocation failed\n");
@@ -278,7 +278,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
goto exit;
}
- lpm->rules_tbl = (struct rte_lpm_rule *)rte_zmalloc_socket(NULL,
+ lpm->rules_tbl = rte_zmalloc_socket(NULL,
(size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);
if (lpm->rules_tbl == NULL) {
@@ -290,7 +290,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
goto exit;
}
- lpm->tbl8 = (struct rte_lpm_tbl_entry *)rte_zmalloc_socket(NULL,
+ lpm->tbl8 = rte_zmalloc_socket(NULL,
(size_t)tbl8s_size, RTE_CACHE_LINE_SIZE, socket_id);
if (lpm->tbl8 == NULL) {
@@ -308,7 +308,7 @@ rte_lpm_create_v1604(const char *name, int socket_id,
lpm->number_tbl8s = config->number_tbl8s;
snprintf(lpm->name, sizeof(lpm->name), "%s", name);
- te->data = (void *) lpm;
+ te->data = lpm;
TAILQ_INSERT_TAIL(lpm_list, te, next);
diff --git a/lib/librte_lpm/rte_lpm6.c b/lib/librte_lpm/rte_lpm6.c
index 45d648571..149677eb1 100644
--- a/lib/librte_lpm/rte_lpm6.c
+++ b/lib/librte_lpm/rte_lpm6.c
@@ -166,7 +166,7 @@ rte_lpm6_create(const char *name, int socket_id,
}
/* Allocate memory to store the LPM data structures. */
- lpm = (struct rte_lpm6 *)rte_zmalloc_socket(mem_name, (size_t)mem_size,
+ lpm = rte_zmalloc_socket(mem_name, (size_t)mem_size,
RTE_CACHE_LINE_SIZE, socket_id);
if (lpm == NULL) {
@@ -176,7 +176,7 @@ rte_lpm6_create(const char *name, int socket_id,
goto exit;
}
- lpm->rules_tbl = (struct rte_lpm6_rule *)rte_zmalloc_socket(NULL,
+ lpm->rules_tbl = rte_zmalloc_socket(NULL,
(size_t)rules_size, RTE_CACHE_LINE_SIZE, socket_id);
if (lpm->rules_tbl == NULL) {
--
2.13.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 2/5] lib/librte_efd: remove unnecessary void * pointer cast using rte_zmalloc_socket
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 1/5] lib/librte_lpm: " Zhiyong Yang
@ 2018-01-15 7:55 ` Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 3/5] lib/librte_hash: " Zhiyong Yang
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Zhiyong Yang @ 2018-01-15 7:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
void * pointer can be assigned to any data type pointer. Unnecessary cast
can be removed in order to keep code clearer.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_efd/rte_efd.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/librte_efd/rte_efd.c b/lib/librte_efd/rte_efd.c
index e15ff04c9..a780e2fe8 100644
--- a/lib/librte_efd/rte_efd.c
+++ b/lib/librte_efd/rte_efd.c
@@ -558,7 +558,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
}
/* Create a new EFD table management structure */
- table = (struct rte_efd_table *) rte_zmalloc_socket(NULL,
+ table = rte_zmalloc_socket(NULL,
sizeof(struct rte_efd_table),
RTE_CACHE_LINE_SIZE,
offline_cpu_socket);
@@ -580,7 +580,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
table->key_len = key_len;
/* key_array */
- key_array = (uint8_t *) rte_zmalloc_socket(NULL,
+ key_array = rte_zmalloc_socket(NULL,
table->max_num_rules * table->key_len,
RTE_CACHE_LINE_SIZE,
offline_cpu_socket);
@@ -616,7 +616,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
* as a continuous block
*/
table->chunks[socket_id] =
- (struct efd_online_chunk *) rte_zmalloc_socket(
+ rte_zmalloc_socket(
NULL,
online_table_size,
RTE_CACHE_LINE_SIZE,
@@ -666,7 +666,7 @@ rte_efd_create(const char *name, uint32_t max_num_rules, uint32_t key_len,
*/
offline_table_size = num_chunks * sizeof(struct efd_offline_chunk_rules);
table->offline_chunks =
- (struct efd_offline_chunk_rules *) rte_zmalloc_socket(NULL,
+ rte_zmalloc_socket(NULL,
offline_table_size,
RTE_CACHE_LINE_SIZE,
offline_cpu_socket);
--
2.13.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 3/5] lib/librte_hash: remove unnecessary void * pointer cast using rte_zmalloc_socket
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 1/5] lib/librte_lpm: " Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 2/5] lib/librte_efd: remove unnecessary void * pointer cast using rte_zmalloc_socket Zhiyong Yang
@ 2018-01-15 7:55 ` Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 4/5] lib/librte_member: remove unnecessary void * pointer cast Zhiyong Yang
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Zhiyong Yang @ 2018-01-15 7:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
void * pointer can be assigned to any data type pointer. Unnecessary cast
can be removed in order to keep code clearer.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_hash/rte_fbk_hash.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_hash/rte_fbk_hash.c b/lib/librte_hash/rte_fbk_hash.c
index a8d0d485d..4aff40e67 100644
--- a/lib/librte_hash/rte_fbk_hash.c
+++ b/lib/librte_hash/rte_fbk_hash.c
@@ -123,7 +123,7 @@ rte_fbk_hash_create(const struct rte_fbk_hash_params *params)
}
/* Allocate memory for table. */
- ht = (struct rte_fbk_hash_table *)rte_zmalloc_socket(hash_name, mem_size,
+ ht = rte_zmalloc_socket(hash_name, mem_size,
0, params->socket_id);
if (ht == NULL) {
RTE_LOG(ERR, HASH, "Failed to allocate fbk hash table\n");
--
2.13.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 4/5] lib/librte_member: remove unnecessary void * pointer cast
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
` (2 preceding siblings ...)
2018-01-15 7:55 ` [dpdk-dev] [PATCH 3/5] lib/librte_hash: " Zhiyong Yang
@ 2018-01-15 7:55 ` Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 5/5] lib/librte_pipeline: remove unnecessary void * pointer cast using rte_zmalloc_socket Zhiyong Yang
2018-01-15 14:29 ` [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Ferruh Yigit
5 siblings, 0 replies; 8+ messages in thread
From: Zhiyong Yang @ 2018-01-15 7:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
void * pointer can be assigned to any data type pointer. Unnecessary cast
can be removed in order to keep code clearer.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_member/rte_member.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_member/rte_member.c b/lib/librte_member/rte_member.c
index 0c4c14470..1366b3d39 100644
--- a/lib/librte_member/rte_member.c
+++ b/lib/librte_member/rte_member.c
@@ -107,7 +107,7 @@ rte_member_create(const struct rte_member_parameters *params)
rte_rwlock_write_lock(RTE_EAL_TAILQ_RWLOCK);
TAILQ_FOREACH(te, member_list, next) {
- setsum = (struct rte_member_setsum *) te->data;
+ setsum = te->data;
if (strncmp(params->name, setsum->name,
RTE_MEMBER_NAMESIZE) == 0)
break;
@@ -125,7 +125,7 @@ rte_member_create(const struct rte_member_parameters *params)
}
/* Create a new setsum structure */
- setsum = (struct rte_member_setsum *) rte_zmalloc_socket(params->name,
+ setsum = rte_zmalloc_socket(params->name,
sizeof(struct rte_member_setsum), RTE_CACHE_LINE_SIZE,
params->socket_id);
if (setsum == NULL) {
--
2.13.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* [dpdk-dev] [PATCH 5/5] lib/librte_pipeline: remove unnecessary void * pointer cast using rte_zmalloc_socket
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
` (3 preceding siblings ...)
2018-01-15 7:55 ` [dpdk-dev] [PATCH 4/5] lib/librte_member: remove unnecessary void * pointer cast Zhiyong Yang
@ 2018-01-15 7:55 ` Zhiyong Yang
2018-01-15 14:29 ` [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Ferruh Yigit
5 siblings, 0 replies; 8+ messages in thread
From: Zhiyong Yang @ 2018-01-15 7:55 UTC (permalink / raw)
To: dev; +Cc: ferruh.yigit, thomas, Zhiyong Yang
void * pointer can be assigned to any data type pointer. Unnecessary cast
can be removed in order to keep code clearer.
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
---
lib/librte_pipeline/rte_pipeline.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_pipeline/rte_pipeline.c b/lib/librte_pipeline/rte_pipeline.c
index 1b331f4df..0cb8b804e 100644
--- a/lib/librte_pipeline/rte_pipeline.c
+++ b/lib/librte_pipeline/rte_pipeline.c
@@ -347,7 +347,7 @@ rte_pipeline_table_create(struct rte_pipeline *p,
/* Allocate space for the default table entry */
entry_size = sizeof(struct rte_pipeline_table_entry) +
params->action_data_size;
- default_entry = (struct rte_pipeline_table_entry *) rte_zmalloc_socket(
+ default_entry = rte_zmalloc_socket(
"PIPELINE", entry_size, RTE_CACHE_LINE_SIZE, p->socket_id);
if (default_entry == NULL) {
RTE_LOG(ERR, PIPELINE,
--
2.13.3
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
` (4 preceding siblings ...)
2018-01-15 7:55 ` [dpdk-dev] [PATCH 5/5] lib/librte_pipeline: remove unnecessary void * pointer cast using rte_zmalloc_socket Zhiyong Yang
@ 2018-01-15 14:29 ` Ferruh Yigit
2018-01-16 0:55 ` Thomas Monjalon
5 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2018-01-15 14:29 UTC (permalink / raw)
To: Zhiyong Yang, dev; +Cc: thomas
On 1/15/2018 7:55 AM, Zhiyong Yang wrote:
> void * pointer can be assigned to any data type pointer. Unnecessary cast
> can be removed in order to keep code clearer.
>
> Zhiyong Yang (5):
> lib/librte_lpm: remove unnecessary void * pointer cast
> lib/librte_efd: remove unnecessary void * pointer cast using
> rte_zmalloc_socket
> lib/librte_hash: remove unnecessary void * pointer cast using
> rte_zmalloc_socket
> lib/librte_member: remove unnecessary void * pointer cast
> lib/librte_pipeline: remove unnecessary void * pointer cast using
> rte_zmalloc_socket
Series
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast
2018-01-15 14:29 ` [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Ferruh Yigit
@ 2018-01-16 0:55 ` Thomas Monjalon
0 siblings, 0 replies; 8+ messages in thread
From: Thomas Monjalon @ 2018-01-16 0:55 UTC (permalink / raw)
To: Zhiyong Yang; +Cc: dev, Ferruh Yigit
15/01/2018 15:29, Ferruh Yigit:
> On 1/15/2018 7:55 AM, Zhiyong Yang wrote:
> > void * pointer can be assigned to any data type pointer. Unnecessary cast
> > can be removed in order to keep code clearer.
> >
> > Zhiyong Yang (5):
> > lib/librte_lpm: remove unnecessary void * pointer cast
> > lib/librte_efd: remove unnecessary void * pointer cast using
> > rte_zmalloc_socket
> > lib/librte_hash: remove unnecessary void * pointer cast using
> > rte_zmalloc_socket
> > lib/librte_member: remove unnecessary void * pointer cast
> > lib/librte_pipeline: remove unnecessary void * pointer cast using
> > rte_zmalloc_socket
>
> Series
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Merged in one patch and applied, thanks
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-01-16 0:56 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-15 7:55 [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 1/5] lib/librte_lpm: " Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 2/5] lib/librte_efd: remove unnecessary void * pointer cast using rte_zmalloc_socket Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 3/5] lib/librte_hash: " Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 4/5] lib/librte_member: remove unnecessary void * pointer cast Zhiyong Yang
2018-01-15 7:55 ` [dpdk-dev] [PATCH 5/5] lib/librte_pipeline: remove unnecessary void * pointer cast using rte_zmalloc_socket Zhiyong Yang
2018-01-15 14:29 ` [dpdk-dev] [PATCH 0/5] remove unnecessary void * pointer cast Ferruh Yigit
2018-01-16 0:55 ` Thomas Monjalon
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).