Commit 523ca58b authored by Masahiro Yamada's avatar Masahiro Yamada

kconfig: remove const qualifier from sym_expand_string_value()

This function returns realloc'ed memory, so the returned pointer
must be passed to free() when done.  So, 'const' qualifier is odd.
It is allowed to modify the expanded string.
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent d717f24d
...@@ -31,7 +31,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; ...@@ -31,7 +31,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];
struct symbol * sym_lookup(const char *name, int flags); struct symbol * sym_lookup(const char *name, int flags);
struct symbol * sym_find(const char *name); struct symbol * sym_find(const char *name);
const char * sym_expand_string_value(const char *in); char *sym_expand_string_value(const char *in);
const char * sym_escape_string_value(const char *in); const char * sym_escape_string_value(const char *in);
struct symbol ** sym_re_search(const char *pattern); struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type); const char * sym_type_name(enum symbol_type type);
......
...@@ -899,7 +899,7 @@ struct symbol *sym_find(const char *name) ...@@ -899,7 +899,7 @@ struct symbol *sym_find(const char *name)
* name to be expanded shall be prefixed by a '$'. Unknown symbol expands to * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
* the empty string. * the empty string.
*/ */
const char *sym_expand_string_value(const char *in) char *sym_expand_string_value(const char *in)
{ {
const char *src; const char *src;
char *res; char *res;
......
...@@ -14,11 +14,11 @@ ...@@ -14,11 +14,11 @@
struct file *file_lookup(const char *name) struct file *file_lookup(const char *name)
{ {
struct file *file; struct file *file;
const char *file_name = sym_expand_string_value(name); char *file_name = sym_expand_string_value(name);
for (file = file_list; file; file = file->next) { for (file = file_list; file; file = file->next) {
if (!strcmp(name, file->name)) { if (!strcmp(name, file->name)) {
free((void *)file_name); free(file_name);
return file; return file;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment