Skip to content

Commit

Permalink
kconfig: remove const qualifier from sym_expand_string_value()
Browse files Browse the repository at this point in the history
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: Masahiro Yamada <yamada.masahiro@socionext.com>
  • Loading branch information
masahir0y committed Feb 10, 2018
1 parent d717f24 commit 523ca58
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/kconfig/lkc_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE];

struct symbol * sym_lookup(const char *name, int flags);
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);
struct symbol ** sym_re_search(const char *pattern);
const char * sym_type_name(enum symbol_type type);
Expand Down
2 changes: 1 addition & 1 deletion scripts/kconfig/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@ struct symbol *sym_find(const char *name)
* name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
* the empty string.
*/
const char *sym_expand_string_value(const char *in)
char *sym_expand_string_value(const char *in)
{
const char *src;
char *res;
Expand Down
4 changes: 2 additions & 2 deletions scripts/kconfig/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
struct file *file_lookup(const char *name)
{
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) {
if (!strcmp(name, file->name)) {
free((void *)file_name);
free(file_name);
return file;
}
}
Expand Down

0 comments on commit 523ca58

Please sign in to comment.