strerror_r: avoid compiler warning
authorEric Blake <eblake@redhat.com>
Thu, 29 Mar 2012 23:02:43 +0000 (17:02 -0600)
committerEric Blake <eblake@redhat.com>
Thu, 29 Mar 2012 23:04:51 +0000 (17:04 -0600)
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 <eblake@redhat.com>
ChangeLog
lib/strerror_r.c

index 86ba7ce..376a5a2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-03-29  Eric Blake  <eblake@redhat.com>
 
+       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.
index be76b0d..76f6fc6 100644 (file)
@@ -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;