aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2019-05-18 14:51:23 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2019-05-18 14:51:23 +0200
commitd4792e12e248e06f247ece3dec7824180ba85f83 (patch)
tree5d3cbe91d5bb24ef19cc44ad6473836111338f6d
parentaef4257f86ea82da68e173a5b8b61e52193f6a36 (diff)
downloadembedlog-d4792e12e248e06f247ece3dec7824180ba85f83.tar.gz
embedlog-d4792e12e248e06f247ece3dec7824180ba85f83.tar.bz2
embedlog-d4792e12e248e06f247ece3dec7824180ba85f83.zip
src/snprintf.c: fix compilation warning with -ansi
When -ansi flag is enabled, configure won't find snprintf() function and will set NEED_SNPRINTF_ONLY. But with it "credits" variable will not be present in compilation unit as it requries PREFER_PORTABLE_SNPRINTF - which we don't want to set. So "str_arg = credits;" should be used only when PREFER_PORTABLE_SNPRINTF is defined. Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rw-r--r--src/snprintf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/snprintf.c b/src/snprintf.c
index 1d349fb..70130f4 100644
--- a/src/snprintf.c
+++ b/src/snprintf.c
@@ -594,7 +594,9 @@ int portable_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap) {
char fmt_spec = '\0';
/* current conversion specifier character */
+#if defined(PREFER_PORTABLE_SNPRINTF)
str_arg = credits;/* just to make compiler happy (defined but not used)*/
+#endif
str_arg = NULL;
starting_p = p; p++; /* skip '%' */
/* parse flags */