tidy-up: replace (1 != expressions 2

This commit is contained in:
Viktor Szakats 2025-07-09 19:38:47 +02:00
parent 3b75d69dbb
commit 4034bc7ebf
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
4 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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));

View file

@ -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 */