From: Alexander Traud Date: Wed, 7 Mar 2018 15:32:05 +0000 (+0100) Subject: utils: In Solaris, avoid a warning about an unused variable. X-Git-Tag: 13.21.0-rc1~85^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=725fd32428a7a65c9322e51a39f4f0d1041e08f3;p=thirdparty%2Fasterisk.git utils: In Solaris, avoid a warning about an unused variable. When HAVE_GETHOSTBYNAME_R_5 was set by the script ./configure, GCC 7.3.0 found an unused variable. Actually, the variable was used (set to a dummy value) but the compiler optimization might have removed that. Instead, this change ensures that the variable 'res' is only used when it is really required. Change-Id: Ic3ea23ccf84ac4bc2d501b514985b989030abab5 --- diff --git a/main/utils.c b/main/utils.c index b4ecffd7e1..56bcdd9592 100644 --- a/main/utils.c +++ b/main/utils.c @@ -196,7 +196,9 @@ static int gethostbyname_r (const char *name, struct hostent *ret, char *buf, */ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) { +#ifndef HAVE_GETHOSTBYNAME_R_5 int res; +#endif int herrno; int dots = 0; const char *s; @@ -206,7 +208,6 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) integers, we break with tradition and refuse to look up a pure integer */ s = host; - res = 0; while (s && *s) { if (*s == '.') dots++;