Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kconfig: massage the loop in conf_read_simple()

Make the while-loop code a little more readable.

The gain is that "CONFIG_FOO" without '=' is warned as unexpected data.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+13 -6
+13 -6
scripts/kconfig/confdata.c
··· 443 443 444 444 while (getline_stripped(&line, &line_asize, in) != -1) { 445 445 conf_lineno++; 446 + 447 + if (!line[0]) /* blank line */ 448 + continue; 449 + 446 450 if (line[0] == '#') { 447 451 if (line[1] != ' ') 448 452 continue; ··· 462 458 continue; 463 459 464 460 val = "n"; 465 - } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) { 461 + } else { 462 + if (memcmp(line, CONFIG_, strlen(CONFIG_))) { 463 + conf_warning("unexpected data: %s", line); 464 + continue; 465 + } 466 + 466 467 sym_name = line + strlen(CONFIG_); 467 468 p = strchr(sym_name, '='); 468 - if (!p) 469 + if (!p) { 470 + conf_warning("unexpected data: %s", line); 469 471 continue; 472 + } 470 473 *p = 0; 471 474 val = p + 1; 472 - } else { 473 - if (line[0] != '\0') 474 - conf_warning("unexpected data: %s", line); 475 - continue; 476 475 } 477 476 478 477 sym = sym_find(sym_name);