[PATCH v2 21/23] examples/l3fwd-graph: resolve shadow variable warning

Stephen Hemminger stephen at networkplumber.org
Tue Apr 7 17:16:17 CEST 2026


Replace global optarg with parameter arg.

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson at intel.com>
---
 examples/l3fwd-graph/main.c      | 8 ++++----
 examples/l3fwd-graph/meson.build | 1 -
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/examples/l3fwd-graph/main.c b/examples/l3fwd-graph/main.c
index 92cdaa1ebe..01c65b0abd 100644
--- a/examples/l3fwd-graph/main.c
+++ b/examples/l3fwd-graph/main.c
@@ -454,16 +454,16 @@ parse_config(const char *q_arg)
 }
 
 static void
-parse_eth_dest(const char *optarg)
+parse_eth_dest(const char *arg)
 {
 	uint8_t c, *dest, peer_addr[6];
 	uint16_t portid;
 	char *port_end;
 
 	errno = 0;
-	portid = strtoul(optarg, &port_end, 10);
-	if (errno != 0 || port_end == optarg || *port_end++ != ',')
-		rte_exit(EXIT_FAILURE, "Invalid eth-dest: %s", optarg);
+	portid = strtoul(arg, &port_end, 10);
+	if (errno != 0 || port_end == arg || *port_end++ != ',')
+		rte_exit(EXIT_FAILURE, "Invalid eth-dest: %s", arg);
 	if (portid >= RTE_MAX_ETHPORTS)
 		rte_exit(EXIT_FAILURE,
 			 "eth-dest: port %d >= RTE_MAX_ETHPORTS(%d)\n", portid,
diff --git a/examples/l3fwd-graph/meson.build b/examples/l3fwd-graph/meson.build
index e3f4fa8df2..b3ceaadb59 100644
--- a/examples/l3fwd-graph/meson.build
+++ b/examples/l3fwd-graph/meson.build
@@ -11,4 +11,3 @@ sources = files(
         'main.c',
 )
 allow_experimental_apis = true
-cflags += no_shadow_cflag
-- 
2.53.0



More information about the dev mailing list