Skip to content

Commit 3278146

Browse files
committed
Remove unnecessary comparison from is_local_port_fixed
Simplify the conditions: - Return false if the port is 0 or a negative number - Return true if the port is a positive number
1 parent 6544c89 commit 3278146

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

ext/socket/ipsocket.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ is_specified_ip_address(const char *hostname)
258258
inet_pton(AF_INET, hostname, &ipv4addr) == 1);
259259
}
260260

261+
261262
static int
262263
is_local_port_fixed(const char *portp)
263264
{
@@ -269,9 +270,8 @@ is_local_port_fixed(const char *portp)
269270

270271
if (endp == portp) return 0;
271272
if (errno == ERANGE) return 0;
272-
if (port <= 0) return 0;
273273

274-
return port != 0;
274+
return port > 0;
275275
}
276276

277277
struct fast_fallback_inetsock_arg

0 commit comments

Comments
 (0)