aboutsummaryrefslogtreecommitdiff
path: root/scripts/kconfig/confdata.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-07-05 11:46:12 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-07-25 23:24:35 +0900
commit5accd7f3360e891bd552312515387dbaa2bb4bf3 (patch)
treed0bc381ad96ae3a69fa211fb2e9053f9d6de421e /scripts/kconfig/confdata.c
parent693359f7ac9012778590a370d076b13db704255e (diff)
downloadlinux-stericsson-5accd7f3360e891bd552312515387dbaa2bb4bf3.tar.gz
kconfig: handle format string before calling conf_message_callback()
As you see in mconf.c and nconf.c, conf_message_callback() hooks are likely to end up with the boilerplate of vsnprintf(). Process the string format before calling conf_message_callback() so that it receives a simple string. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Reviewed-by: Dirk Gouders <dirk@gouders.net>
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r--scripts/kconfig/confdata.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index d1216e4ade2f..629ad32d4708 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -43,16 +43,16 @@ static void conf_warning(const char *fmt, ...)
conf_warnings++;
}
-static void conf_default_message_callback(const char *fmt, va_list ap)
+static void conf_default_message_callback(const char *s)
{
printf("#\n# ");
- vprintf(fmt, ap);
+ printf("%s", s);
printf("\n#\n");
}
-static void (*conf_message_callback) (const char *fmt, va_list ap) =
+static void (*conf_message_callback)(const char *s) =
conf_default_message_callback;
-void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
+void conf_set_message_callback(void (*fn)(const char *s))
{
conf_message_callback = fn;
}
@@ -60,10 +60,15 @@ void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
static void conf_message(const char *fmt, ...)
{
va_list ap;
+ char buf[4096];
+
+ if (!conf_message_callback)
+ return;
va_start(ap, fmt);
- if (conf_message_callback)
- conf_message_callback(fmt, ap);
+
+ vsnprintf(buf, sizeof(buf), fmt, ap);
+ conf_message_callback(buf);
va_end(ap);
}