kconfig: expand file names
authorArnaud Lacombe <lacombar@gmail.com>
Sat, 4 Sep 2010 20:11:26 +0000 (16:11 -0400)
committerArnaud Lacombe <lacombar@gmail.com>
Mon, 20 Sep 2010 02:54:07 +0000 (22:54 -0400)
This will allow to use the following construct in source files:

config FOO
    string
    default "foo"

source "$FOO/Kconfig"

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Michal Marek <mmarek@suse.cz>
scripts/kconfig/util.c

index 78b5c04e736bcfad3f25d7f85fe2b5660572cb52..6330cc871a471495e6820be441c96ea61c6886a1 100644 (file)
 struct file *file_lookup(const char *name)
 {
        struct file *file;
+       const char *file_name = sym_expand_string_value(name);
 
        for (file = file_list; file; file = file->next) {
-               if (!strcmp(name, file->name))
+               if (!strcmp(name, file->name)) {
+                       free((void *)file_name);
                        return file;
+               }
        }
 
        file = malloc(sizeof(*file));
        memset(file, 0, sizeof(*file));
-       file->name = strdup(name);
+       file->name = file_name;
        file->next = file_list;
        file_list = file;
        return file;