Mercurial > hg > octave-lyh > gnulib-hg
changeset 16725:fb659d60019f
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 <eblake@redhat.com>
author | Eric Blake <eblake@redhat.com> |
---|---|
date | Thu, 29 Mar 2012 17:02:43 -0600 |
parents | 1d4824d7f352 |
children | 518ff78686bb |
files | ChangeLog lib/strerror_r.c |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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 @@ #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;