From: Eric Blake Date: Thu, 29 Mar 2012 23:02:43 +0000 (-0600) Subject: strerror_r: avoid compiler warning X-Git-Tag: v0.1~801 X-Git-Url: http://erislabs.net/gitweb/?p=gnulib.git;a=commitdiff_plain;h=ff2219ecb13f22326c5b985fd981cb50e23cdb14 strerror_r: avoid compiler warning Nested declarations are easy to avoid, and doing so avoids at least libvirt's choice of compiler warnings. * lib/strerror_r.c (strerror_r): Hoist extern declaration to top level. Signed-off-by: Eric Blake --- diff --git a/ChangeLog b/ChangeLog index 86ba7ceca..376a5a29c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2012-03-29 Eric Blake + strerror_r: avoid compiler warning + * lib/strerror_r.c (strerror_r): Hoist extern declaration to top + level. + fflush: avoid compiler warning * lib/fflush.c (update_fpos_cache): Mark variables that are potentially unused. diff --git a/lib/strerror_r.c b/lib/strerror_r.c index be76b0d37..76f6fc64d 100644 --- a/lib/strerror_r.c +++ b/lib/strerror_r.c @@ -34,6 +34,7 @@ #if (__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) && HAVE___XPG_STRERROR_R /* glibc >= 2.3.4, cygwin >= 1.7.9 */ # define USE_XPG_STRERROR_R 1 +extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen); #elif HAVE_DECL_STRERROR_R && !(__GLIBC__ >= 2 || defined __UCLIBC__ || defined __CYGWIN__) @@ -161,8 +162,6 @@ strerror_r (int errnum, char *buf, size_t buflen) #if USE_XPG_STRERROR_R { - extern int __xpg_strerror_r (int errnum, char *buf, size_t buflen); - ret = __xpg_strerror_r (errnum, buf, buflen); if (ret < 0) ret = errno;