diff options
author | Marcel Raad <Marcel.Raad@teamviewer.com> | 2019-05-11 21:42:48 +0200 |
---|---|---|
committer | Marcel Raad <Marcel.Raad@teamviewer.com> | 2019-05-20 08:51:11 +0200 |
commit | 10db3ef21eef1c7a1727579952a81ced2f4afc8b (patch) | |
tree | 57129a847b5913959063a60290201b1f52482fee /lib/connect.c | |
parent | 27af2ec219244bef24e6d11649d41aad3668da45 (diff) | |
download | curl-10db3ef21eef1c7a1727579952a81ced2f4afc8b.tar.gz |
lib: reduce variable scopes
Fixes Codacy/CppCheck warnings.
Closes https://github.com/curl/curl/pull/3872
Diffstat (limited to 'lib/connect.c')
-rw-r--r-- | lib/connect.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/connect.c b/lib/connect.c index 0250ceb45..b106fa872 100644 --- a/lib/connect.c +++ b/lib/connect.c @@ -628,7 +628,6 @@ UNITTEST bool getaddressinfo(struct sockaddr *sa, char *addr, UNITTEST bool getaddressinfo(struct sockaddr *sa, char *addr, long *port) { - unsigned short us_port; struct sockaddr_in *si = NULL; #ifdef ENABLE_IPV6 struct sockaddr_in6 *si6 = NULL; @@ -642,7 +641,7 @@ UNITTEST bool getaddressinfo(struct sockaddr *sa, char *addr, si = (struct sockaddr_in *)(void *) sa; if(Curl_inet_ntop(sa->sa_family, &si->sin_addr, addr, MAX_IPADR_LEN)) { - us_port = ntohs(si->sin_port); + unsigned short us_port = ntohs(si->sin_port); *port = us_port; return TRUE; } @@ -652,7 +651,7 @@ UNITTEST bool getaddressinfo(struct sockaddr *sa, char *addr, si6 = (struct sockaddr_in6 *)(void *) sa; if(Curl_inet_ntop(sa->sa_family, &si6->sin6_addr, addr, MAX_IPADR_LEN)) { - us_port = ntohs(si6->sin6_port); + unsigned short us_port = ntohs(si6->sin6_port); *port = us_port; return TRUE; } |