Commit 8baefd30 authored by Arnaud Lacombe's avatar Arnaud Lacombe

kconfig: replace a `switch()' statement by a more flexible `if()' statement

With the upcoming dynamical configuration prefix, we can no longer assume that
the prefix will start by a 'C'. As such, we can no longer hardcode this value in
the `case ...:', so replace the `switch() { ... }' statement by a more flexible
'if () { ... }' statement.
Signed-off-by: default avatarArnaud Lacombe <lacombar@gmail.com>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarMichal Marek <mmarek@suse.cz>
parent 71d80662
...@@ -221,8 +221,7 @@ int conf_read_simple(const char *name, int def) ...@@ -221,8 +221,7 @@ int conf_read_simple(const char *name, int def)
while (fgets(line, sizeof(line), in)) { while (fgets(line, sizeof(line), in)) {
conf_lineno++; conf_lineno++;
sym = NULL; sym = NULL;
switch (line[0]) { if (line[0] == '#') {
case '#':
if (memcmp(line + 2, "CONFIG_", 7)) if (memcmp(line + 2, "CONFIG_", 7))
continue; continue;
p = strchr(line + 9, ' '); p = strchr(line + 9, ' ');
...@@ -254,12 +253,7 @@ int conf_read_simple(const char *name, int def) ...@@ -254,12 +253,7 @@ int conf_read_simple(const char *name, int def)
default: default:
; ;
} }
break; } else if (memcmp(line, "CONFIG_", 7) == 0) {
case 'C':
if (memcmp(line, "CONFIG_", 7)) {
conf_warning("unexpected data");
continue;
}
p = strchr(line + 7, '='); p = strchr(line + 7, '=');
if (!p) if (!p)
continue; continue;
...@@ -286,12 +280,9 @@ int conf_read_simple(const char *name, int def) ...@@ -286,12 +280,9 @@ int conf_read_simple(const char *name, int def)
} }
if (conf_set_sym_val(sym, def, def_flags, p)) if (conf_set_sym_val(sym, def, def_flags, p))
continue; continue;
break; } else {
case '\r': if (line[0] != '\r' && line[0] != '\n')
case '\n': conf_warning("unexpected data");
break;
default:
conf_warning("unexpected data");
continue; continue;
} }
if (sym && sym_is_choice_value(sym)) { if (sym && sym_is_choice_value(sym)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment