[PATCH 14/32] table: replace memcpy with structure assignment

Stephen Hemminger stephen at networkplumber.org
Sat Feb 8 21:22:06 CET 2025


Prefer structure assignment over memcpy.
Found by struct-assign.cocci.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/table/rte_swx_table_selector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/table/rte_swx_table_selector.c b/lib/table/rte_swx_table_selector.c
index 18e021fe6f..da693cdba6 100644
--- a/lib/table/rte_swx_table_selector.c
+++ b/lib/table/rte_swx_table_selector.c
@@ -225,7 +225,7 @@ table_params_copy(struct table *t, struct rte_swx_table_selector_params *params)
 	if (selector_size < 8)
 		selector_size = 8;
 
-	memcpy(&t->params, params, sizeof(struct rte_swx_table_selector_params));
+	t->params = *params;
 	t->params.selector_size = selector_size;
 	t->params.selector_mask = NULL;
 	t->params.n_groups_max = rte_align32pow2(params->n_groups_max);
-- 
2.47.2



More information about the dev mailing list