From d4792e12e248e06f247ece3dec7824180ba85f83 Mon Sep 17 00:00:00 2001 From: Michał Łyszczek Date: Sat, 18 May 2019 14:51:23 +0200 Subject: src/snprintf.c: fix compilation warning with -ansi MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/snprintf.c | 2 ++ 1 file changed, 2 insertions(+) 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 */ -- cgit v1.2.3-8-gadcc