From 4034bc7ebf74df7955565a7f22f26d6210561728 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 9 Jul 2025 19:38:47 +0200 Subject: [PATCH] tidy-up: replace `(1 != ` expressions 2 --- docs/examples/block_ip.c | 2 +- lib/noproxy.c | 8 ++++---- lib/socks.c | 2 +- lib/urlapi.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/examples/block_ip.c b/docs/examples/block_ip.c index bff7b6353c..a6609d3428 100644 --- a/docs/examples/block_ip.c +++ b/docs/examples/block_ip.c @@ -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; diff --git a/lib/noproxy.c b/lib/noproxy.c index 306cd6d1f9..a8f855bbd1 100644 --- a/lib/noproxy.c +++ b/lib/noproxy.c @@ -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; diff --git a/lib/socks.c b/lib/socks.c index 58132cb42d..79f8b15d8b 100644 --- a/lib/socks.c +++ b/lib/socks.c @@ -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)); diff --git a/lib/urlapi.c b/lib/urlapi.c index c266fd3ebc..2ed1a9b0d6 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -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 */