[3/3] bitrate: use RTE_DIM instead of ARRAY_SIZE
diff mbox series

Message ID 20191011040709.8344-3-pbhagavatula@marvell.com
State Superseded
Headers show
Series
  • [1/3] app/test: use RTE_DIM instead of ARRAY_SIZE
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh Bhagavatula Oct. 11, 2019, 4:07 a.m. UTC
From: Pavan Nikhilesh <pbhagavatula@marvell.com>

Use RTE_DIM instead of re-defining ARRAY_SIZE.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
---
 lib/librte_bitratestats/rte_bitrate.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c
index 639e47547..d18152365 100644
--- a/lib/librte_bitratestats/rte_bitrate.c
+++ b/lib/librte_bitratestats/rte_bitrate.c
@@ -8,8 +8,6 @@ 
 #include <rte_metrics.h>
 #include <rte_bitrate.h>
 
-#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
-
 /*
  * Persistent bit-rate data.
  * @internal
@@ -50,7 +48,7 @@  rte_stats_bitrate_reg(struct rte_stats_bitrates *bitrate_data)
 	if (bitrate_data == NULL)
 		return -EINVAL;
 
-	return_value = rte_metrics_reg_names(&names[0], ARRAY_SIZE(names));
+	return_value = rte_metrics_reg_names(&names[0], RTE_DIM(names));
 	if (return_value >= 0)
 		bitrate_data->id_stats_set = return_value;
 	return return_value;
@@ -126,7 +124,7 @@  rte_stats_bitrate_calc(struct rte_stats_bitrates *bitrate_data,
 	values[4] = port_data->peak_ibits;
 	values[5] = port_data->peak_obits;
 	ret = rte_metrics_update_values(port_id, bitrate_data->id_stats_set,
-		values, ARRAY_SIZE(values));
+		values, RTE_DIM(values));
 	if (ret < 0)
 		return ret;