History

kconfig: remove string expansion in file_lookup()

There are two callers of file_lookup(), but there is no more reason to expand the given path. [1] zconf_initscan() This is used to open the first Kconfig. sym_expand_string_value() has never been used in a useful way here; before opening the first Kconfig file, obviously there is no symbol to expand. If you use expand_string_value() instead, environments in KBUILD_KCONFIG would be expanded, but I do not see practical benefits for that. [2] zconf_nextfile() This is used to open the next file from 'source' statement. Symbols in the path like "arch/$SRCARCH/Kconfig" needed expanding, but it was replaced with the direct environment expansion. The environment has already been expanded before the token is passed to the parser. By the way, file_lookup() was already buggy; it expanded a given path, but it used the path before expansion for look-up: if (!strcmp(name, file->name)) {

Masahiro Yamada committed 8 years ago

Commit bb222ce1 parent 104daea1 file · +1 −3Browse files

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

Unified · Split

scripts/kconfig/util.c+1−3
@@ -14,18 +14,16 @@ · 13 unmodified lines
1414 struct file *file_lookup(const char *name)
1515 {
1616 struct file *file;
17− char *file_name = sym_expand_string_value(name);
1817
1918 for (file = file_list; file; file = file->next) {
2019 if (!strcmp(name, file->name)) {
21− free(file_name);
2220 return file;
2321 }
2422 }
2523
2624 file = xmalloc(sizeof(*file));
2725 memset(file, 0, sizeof(*file));
28− file->name = file_name;
26+ file->name = xstrdup(name);
2927 file->next = file_list;
3028 file_list = file;
3129 return file;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t