eal: do not use static option iterator
authorGaetan Rivet <gaetan.rivet@6wind.com>
Thu, 20 Dec 2018 17:06:41 +0000 (18:06 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Tue, 15 Jan 2019 01:40:40 +0000 (02:40 +0100)
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

index 3fbc13a..9e233f7 100644 (file)
@@ -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();