changeset 17424:c2521dab0c42

vasnprintf: silence mingw compiler warning On mingw, vasnprintf is able to use snprintf, but not its return value; this led to a situation where gcc warns: vasnprintf.c: In function 'vasnprintf': vasnprintf.c:4609:21: error: variable 'has_width' set but not used [-Werror=unused-but-set-variable] Rather than hacking through a bunch of #ifdefs, where some used both variables and others only used one, I changed the lone use of just 'width' to also use 'has_width'. * lib/vasnprintf.c (VASNPRINTF): Avoid unused variable warning. Signed-off-by: Eric Blake <eblake@redhat.com>
author Eric Blake <eblake@redhat.com>
date Wed, 29 May 2013 17:47:50 -0600
parents 6105f1dfb98e
children 828f503029b0
files ChangeLog lib/vasnprintf.c
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-05-30  Eric Blake  <eblake@redhat.com>
+
+	vasnprintf: silence mingw compiler warning
+	* lib/vasnprintf.c (VASNPRINTF): Avoid unused variable warning.
+
 2013-05-29  Paul Eggert  <eggert@cs.ucla.edu>
 
 	c-ctype, regex, verify: port to gcc -std=c90 -pedantic
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -5153,7 +5153,8 @@
                                 size_t tmp_length =
                                   MAX_ROOM_NEEDED (&a, dp->arg_index,
                                                    dp->conversion, type, flags,
-                                                   width, has_precision,
+                                                   has_width ? width : 0,
+                                                   has_precision,
                                                    precision, pad_ourselves);
 
                                 if (maxlen < tmp_length)