1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-12 21:01:52 +03:00

Avoid conflicts with library versions of inet_net_ntop() and friends.

Prefix inet_net_ntop and sibling routines with "pg_" to ensure that
they aren't mistaken for C-library functions.  This fixes warnings
from cpluspluscheck on some platforms, and should help reduce reader
confusion everywhere, since our functions aren't exactly interchangeable
with the library versions (they may have different ideas about address
family codes).

This shouldn't be fixing any actual bugs, unless somebody's linker
is misbehaving, so no need to back-patch.

Discussion: https://postgr.es/m/20518.1559494394@sss.pgh.pa.us
This commit is contained in:
Tom Lane
2019-08-18 19:27:23 -04:00
parent 232720be9b
commit 927f34ce8a
8 changed files with 39 additions and 38 deletions

View File

@ -42,7 +42,7 @@ static int inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size);
/*
* int
* inet_net_pton(af, src, dst, size)
* pg_inet_net_pton(af, src, dst, size)
* convert network number from presentation to network format.
* accepts hex octets, hex strings, decimal octets, and /CIDR.
* "size" is in bytes and describes "dst".
@ -59,7 +59,7 @@ static int inet_cidr_pton_ipv6(const char *src, u_char *dst, size_t size);
*
*/
int
inet_net_pton(int af, const char *src, void *dst, size_t size)
pg_inet_net_pton(int af, const char *src, void *dst, size_t size)
{
switch (af)
{
@ -241,7 +241,7 @@ emsgsize:
/*
* int
* inet_net_pton(af, src, dst, *bits)
* inet_net_pton_ipv4(af, src, dst, *bits)
* convert network address from presentation to network format.
* accepts inet_pton()'s input for this "af" plus trailing "/CIDR".
* "dst" is assumed large enough for its "af". "bits" is set to the