History

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.

Arnaud Lacombe committed 16 years ago

Commit 8baefd31 parent 71d80661 file · +5 −14Browse files

Showing the changes to scripts (1 of 1 file). Show all

Unified · Split

scripts/kconfig/confdata.c+5−14
@@ -221,8 +221,7 @@ load: · 220 unmodified lines
221221 while (fgets(line, sizeof(line), in)) {
222222 conf_lineno++;
223223 sym = NULL;
224− switch (line[0]) {
225− case '#':
224+ if (line[0] == '#') {
226225 if (memcmp(line + 2, "CONFIG_", 7))
227226 continue;
228227 p = strchr(line + 9, ' ');
@@ -254,12 +253,7 @@ load: · 25 unmodified lines
254253 default:
255254 ;
256255 }
257− break;
258− case 'C':
259− if (memcmp(line, "CONFIG_", 7)) {
260− conf_warning("unexpected data");
261− continue;
262− }
256+ } else if (memcmp(line, "CONFIG_", 7) == 0) {
263257 p = strchr(line + 7, '=');
264258 if (!p)
265259 continue;
@@ -286,12 +280,9 @@ load: · 20 unmodified lines
286280 }
287281 if (conf_set_sym_val(sym, def, def_flags, p))
288282 continue;
289− break;
290− case '\r':
291− case '\n':
292− break;
293− default:
294− conf_warning("unexpected data");
283+ } else {
284+ if (line[0] != '\r' && line[0] != '\n')
285+ conf_warning("unexpected data");
295286 continue;
296287 }
297288 if (sym && sym_is_choice_value(sym)) {