From f1c16d40ed843923bde9b9e8362f11cffa486fb8 Mon Sep 17 00:00:00 2001 From: Pavan Nikhilesh Date: Thu, 17 Oct 2019 17:40:00 +0530 Subject: [PATCH] bitrate: use common macro RTE_DIM Use RTE_DIM instead of re-defining ARRAY_SIZE. Signed-off-by: Pavan Nikhilesh Reviewed-by: David Marchand --- lib/librte_bitratestats/rte_bitrate.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_bitratestats/rte_bitrate.c b/lib/librte_bitratestats/rte_bitrate.c index 639e47547d..d18152365e 100644 --- a/lib/librte_bitratestats/rte_bitrate.c +++ b/lib/librte_bitratestats/rte_bitrate.c @@ -8,8 +8,6 @@ #include #include -#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; -- 2.20.1