mirror of
https://github.com/curl/curl.git
synced 2026-06-06 23:54:16 +03:00
tidy-up: replace (1 != expressions 2
This commit is contained in:
parent
3b75d69dbb
commit
4034bc7ebf
4 changed files with 7 additions and 7 deletions
|
|
@ -155,7 +155,7 @@ static struct ip *ip_list_append(struct ip *list, const char *data)
|
|||
ip->maskbits = 128;
|
||||
#endif
|
||||
|
||||
if(1 != inet_pton(ip->family, ip->str, &ip->netaddr)) {
|
||||
if(inet_pton(ip->family, ip->str, &ip->netaddr) != 1) {
|
||||
free(ip->str);
|
||||
free(ip);
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ UNITTEST bool Curl_cidr4_match(const char *ipv4, /* 1.2.3.4 address */
|
|||
/* strange input */
|
||||
return FALSE;
|
||||
|
||||
if(1 != curlx_inet_pton(AF_INET, ipv4, &address))
|
||||
if(curlx_inet_pton(AF_INET, ipv4, &address) != 1)
|
||||
return FALSE;
|
||||
if(1 != curlx_inet_pton(AF_INET, network, &check))
|
||||
if(curlx_inet_pton(AF_INET, network, &check) != 1)
|
||||
return FALSE;
|
||||
|
||||
if(bits && (bits != 32)) {
|
||||
|
|
@ -92,9 +92,9 @@ UNITTEST bool Curl_cidr6_match(const char *ipv6,
|
|||
rest = bits & 0x07;
|
||||
if((bytes > 16) || ((bytes == 16) && rest))
|
||||
return FALSE;
|
||||
if(1 != curlx_inet_pton(AF_INET6, ipv6, address))
|
||||
if(curlx_inet_pton(AF_INET6, ipv6, address) != 1)
|
||||
return FALSE;
|
||||
if(1 != curlx_inet_pton(AF_INET6, network, check))
|
||||
if(curlx_inet_pton(AF_INET6, network, check) != 1)
|
||||
return FALSE;
|
||||
if(bytes && memcmp(address, check, bytes))
|
||||
return FALSE;
|
||||
|
|
|
|||
|
|
@ -876,7 +876,7 @@ CONNECT_RESOLVE_REMOTE:
|
|||
#ifdef USE_IPV6
|
||||
if(conn->bits.ipv6_ip) {
|
||||
char ip6[16];
|
||||
if(1 != curlx_inet_pton(AF_INET6, sx->hostname, ip6))
|
||||
if(curlx_inet_pton(AF_INET6, sx->hostname, ip6) != 1)
|
||||
return CURLPX_BAD_ADDRESS_TYPE;
|
||||
socksreq[len++] = 4;
|
||||
memcpy(&socksreq[len], ip6, sizeof(ip6));
|
||||
|
|
|
|||
|
|
@ -511,7 +511,7 @@ static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
|
|||
{
|
||||
char dest[16]; /* fits a binary IPv6 address */
|
||||
hostname[hlen] = 0; /* end the address there */
|
||||
if(1 != curlx_inet_pton(AF_INET6, hostname, dest))
|
||||
if(curlx_inet_pton(AF_INET6, hostname, dest) != 1)
|
||||
return CURLUE_BAD_IPV6;
|
||||
if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen)) {
|
||||
hlen = strlen(hostname); /* might be shorter now */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue