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.
Showing the changes to scripts (1 of 1 file). Show all
Unified · Split
| @@ -221,8 +221,7 @@ load: · 220 unmodified lines | ||
| 221 | 221 | while (fgets(line, sizeof(line), in)) { |
| 222 | 222 | conf_lineno++; |
| 223 | 223 | sym = NULL; |
| 224 | − switch (line[0]) { | |
| 225 | − case '#': | |
| 224 | + if (line[0] == '#') { | |
| 226 | 225 | if (memcmp(line + 2, "CONFIG_", 7)) |
| 227 | 226 | continue; |
| 228 | 227 | p = strchr(line + 9, ' '); |
| @@ -254,12 +253,7 @@ load: · 25 unmodified lines | ||
| 254 | 253 | default: |
| 255 | 254 | ; |
| 256 | 255 | } |
| 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) { | |
| 263 | 257 | p = strchr(line + 7, '='); |
| 264 | 258 | if (!p) |
| 265 | 259 | continue; |
| @@ -286,12 +280,9 @@ load: · 20 unmodified lines | ||
| 286 | 280 | } |
| 287 | 281 | if (conf_set_sym_val(sym, def, def_flags, p)) |
| 288 | 282 | 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"); | |
| 295 | 286 | continue; |
| 296 | 287 | } |
| 297 | 288 | if (sym && sym_is_choice_value(sym)) { |