From ce6448fa0108a9d10faba3610be12c673ceb245d Mon Sep 17 00:00:00 2001 From: Gaetan Rivet Date: Thu, 20 Dec 2018 18:06:41 +0100 Subject: [PATCH] eal: do not use static option iterator This is rather weird. Someone should have caught that during review. Signed-off-by: Gaetan Rivet --- lib/librte_eal/common/rte_option.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/rte_option.c b/lib/librte_eal/common/rte_option.c index 3fbc13a6a7..9e233f7d2f 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(); -- 2.20.1