[v1,2/8] option: do not use static iterator

Message ID 1a4e58797e63142a15039bd288e746bb1c6684ce.1545325395.git.gaetan.rivet@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series Clean up rte_option |

Checks

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

Commit Message

Gaëtan Rivet Dec. 20, 2018, 5:06 p.m. UTC
  This is rather weird. Someone should have caught that during review.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
 lib/librte_eal/common/rte_option.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
  

Patch

diff --git a/lib/librte_eal/common/rte_option.c b/lib/librte_eal/common/rte_option.c
index 3fbc13a6a..9e233f7d2 100644
--- a/lib/librte_eal/common/rte_option.c
+++ b/lib/librte_eal/common/rte_option.c
@@ -15,11 +15,11 @@  TAILQ_HEAD(rte_option_list, rte_option);
 struct rte_option_list rte_option_list =
 	TAILQ_HEAD_INITIALIZER(rte_option_list);
 
-static struct rte_option *option;
-
 int
 rte_option_parse(const char *opt)
 {
+	struct rte_option *option;
+
 	if (strlen(opt) <= 2 ||
 	    strncmp(opt, "--", 2))
 		return -1;
@@ -38,6 +38,8 @@  rte_option_parse(const char *opt)
 void __rte_experimental
 rte_option_register(struct rte_option *opt)
 {
+	struct rte_option *option;
+
 	TAILQ_FOREACH(option, &rte_option_list, next) {
 		if (strcmp(opt->opt_str, option->opt_str) == 0) {
 			RTE_LOG(INFO, EAL, "Option %s has already been registered.\n",
@@ -52,6 +54,8 @@  rte_option_register(struct rte_option *opt)
 void
 rte_option_init(void)
 {
+	struct rte_option *option;
+
 	TAILQ_FOREACH(option, &rte_option_list, next) {
 		if (option->enabled)
 			option->cb();