Skip to content

Commit

Permalink
kconfig: replace a switch()' statement by a more flexible if()' sta…
Browse files Browse the repository at this point in the history
…tement

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: Arnaud Lacombe <lacombar@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Michal Marek <mmarek@suse.cz>
  • Loading branch information
Arnaud Lacombe committed Sep 19, 2010
1 parent 71d8066 commit 8baefd3
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions scripts/kconfig/confdata.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,7 @@ int conf_read_simple(const char *name, int def)
while (fgets(line, sizeof(line), in)) {
conf_lineno++;
sym = NULL;
switch (line[0]) {
case '#':
if (line[0] == '#') {
if (memcmp(line + 2, "CONFIG_", 7))
continue;
p = strchr(line + 9, ' ');
Expand Down Expand Up @@ -254,12 +253,7 @@ int conf_read_simple(const char *name, int def)
default:
;
}
break;
case 'C':
if (memcmp(line, "CONFIG_", 7)) {
conf_warning("unexpected data");
continue;
}
} else if (memcmp(line, "CONFIG_", 7) == 0) {
p = strchr(line + 7, '=');
if (!p)
continue;
Expand All @@ -286,12 +280,9 @@ int conf_read_simple(const char *name, int def)
}
if (conf_set_sym_val(sym, def, def_flags, p))
continue;
break;
case '\r':
case '\n':
break;
default:
conf_warning("unexpected data");
} else {
if (line[0] != '\r' && line[0] != '\n')
conf_warning("unexpected data");
continue;
}
if (sym && sym_is_choice_value(sym)) {
Expand Down

0 comments on commit 8baefd3

Please sign in to comment.