[Asterisk-code-review] utils: In Solaris, avoid a warning about an unused variable. (asterisk[master])

Jenkins2 asteriskteam at digium.com
Thu Mar 8 13:30:31 CST 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8456 )

Change subject: utils: In Solaris, avoid a warning about an unused variable.
......................................................................

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
---
M main/utils.c
1 file changed, 2 insertions(+), 1 deletion(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/utils.c b/main/utils.c
index 7f74f40..928b89b 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -189,7 +189,9 @@
 */
 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;
@@ -199,7 +201,6 @@
 	   integers, we break with tradition and refuse to look up a
 	   pure integer */
 	s = host;
-	res = 0;
 	while (s && *s) {
 		if (*s == '.')
 			dots++;

-- 
To view, visit https://gerrit.asterisk.org/8456
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic3ea23ccf84ac4bc2d501b514985b989030abab5
Gerrit-Change-Number: 8456
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180308/72e8781a/attachment-0001.html>


More information about the asterisk-code-review mailing list