1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-24 00:23:06 +03:00

Use clearer notation for getnameinfo() return handling

Writing

    if (getnameinfo(...))
        handle_error();

reads quite strangely, so use something like

    if (getnameinfo(...) != 0)
        handle_error();

instead.
This commit is contained in:
Peter Eisentraut
2011-08-09 18:28:35 +03:00
parent 77949a2913
commit f4a9da0a15
4 changed files with 16 additions and 16 deletions

View File

@@ -1093,7 +1093,7 @@ inet_client_addr(PG_FUNCTION_ARGS)
remote_host, sizeof(remote_host),
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV);
if (ret)
if (ret != 0)
PG_RETURN_NULL();
clean_ipv6_addr(port->raddr.addr.ss_family, remote_host);
@@ -1132,7 +1132,7 @@ inet_client_port(PG_FUNCTION_ARGS)
NULL, 0,
remote_port, sizeof(remote_port),
NI_NUMERICHOST | NI_NUMERICSERV);
if (ret)
if (ret != 0)
PG_RETURN_NULL();
PG_RETURN_DATUM(DirectFunctionCall1(int4in, CStringGetDatum(remote_port)));
@@ -1169,7 +1169,7 @@ inet_server_addr(PG_FUNCTION_ARGS)
local_host, sizeof(local_host),
NULL, 0,
NI_NUMERICHOST | NI_NUMERICSERV);
if (ret)
if (ret != 0)
PG_RETURN_NULL();
clean_ipv6_addr(port->laddr.addr.ss_family, local_host);
@@ -1208,7 +1208,7 @@ inet_server_port(PG_FUNCTION_ARGS)
NULL, 0,
local_port, sizeof(local_port),
NI_NUMERICHOST | NI_NUMERICSERV);
if (ret)
if (ret != 0)
PG_RETURN_NULL();
PG_RETURN_DATUM(DirectFunctionCall1(int4in, CStringGetDatum(local_port)));