* [PATCH 2/3] kconfig: remove const qualifier from str_get()
2022-11-13 10:59 [PATCH 1/3] kconfig: remove unneeded variable in get_prompt_str() Masahiro Yamada
@ 2022-11-13 10:59 ` Masahiro Yamada
2022-11-13 10:59 ` [PATCH 3/3] kconfig: remove redundant (void *) cast in search_conf() Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2022-11-13 10:59 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
update_text() apparently edits the buffer returned by str_get().
(and there is no reason why it shouldn't)
Remove 'const' quailifier and casting.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/lkc.h | 2 +-
scripts/kconfig/mconf.c | 4 ++--
scripts/kconfig/util.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 6ac2eabe109d..e7118d62a45f 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -76,7 +76,7 @@ struct gstr str_new(void);
void str_free(struct gstr *gs);
void str_append(struct gstr *gs, const char *s);
void str_printf(struct gstr *gs, const char *fmt, ...);
-const char *str_get(struct gstr *gs);
+char *str_get(struct gstr *gs);
/* menu.c */
void _menu_init(void);
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 9d3cf510562f..d7f7e1bf7dd4 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -440,8 +440,8 @@ static void search_conf(void)
res = get_relations_str(sym_arr, &head);
set_subtitle();
- dres = show_textbox_ext("Search Results", (char *)
- str_get(&res), 0, 0, keys, &vscroll,
+ dres = show_textbox_ext("Search Results", str_get(&res), 0, 0,
+ keys, &vscroll,
&hscroll, &update_text, (void *)
&data);
again = false;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index 29585394df71..b78f114ad48c 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -74,7 +74,7 @@ void str_printf(struct gstr *gs, const char *fmt, ...)
}
/* Retrieve value of growable string */
-const char *str_get(struct gstr *gs)
+char *str_get(struct gstr *gs)
{
return gs->s;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 3/3] kconfig: remove redundant (void *) cast in search_conf()
2022-11-13 10:59 [PATCH 1/3] kconfig: remove unneeded variable in get_prompt_str() Masahiro Yamada
2022-11-13 10:59 ` [PATCH 2/3] kconfig: remove const qualifier from str_get() Masahiro Yamada
@ 2022-11-13 10:59 ` Masahiro Yamada
1 sibling, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2022-11-13 10:59 UTC (permalink / raw)
To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel
The (void *) cast is redundant because the last argument of
show_textbox_ext() is an opaque pointer.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/kconfig/mconf.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index d7f7e1bf7dd4..9c549683c627 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -441,8 +441,7 @@ static void search_conf(void)
res = get_relations_str(sym_arr, &head);
set_subtitle();
dres = show_textbox_ext("Search Results", str_get(&res), 0, 0,
- keys, &vscroll,
- &hscroll, &update_text, (void *)
+ keys, &vscroll, &hscroll, &update_text,
&data);
again = false;
for (i = 0; i < JUMP_NB && keys[i]; i++)
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread