From: Masahiro Yamada Date: Thu, 8 Feb 2018 16:19:08 +0000 (+0900) Subject: kconfig: remove const qualifier from sym_expand_string_value() X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=65512385c67686caa41208d6a1a9b71fb2f57639;p=carl9170fw.git 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: Masahiro Yamada Signed-off-by: Christian Lamparter --- diff --git a/config/lkc_proto.h b/config/lkc_proto.h index 5d86e2d..9dc8abf 100644 --- a/config/lkc_proto.h +++ b/config/lkc_proto.h @@ -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); diff --git a/config/symbol.c b/config/symbol.c index 60a76f9..cca9663 100644 --- a/config/symbol.c +++ b/config/symbol.c @@ -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; diff --git a/config/util.c b/config/util.c index 138894e..b98a79e 100644 --- a/config/util.c +++ b/config/util.c @@ -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; } }