mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Don't re-invent the strchr() wheel.
This commit is contained in:
parent
61c9ea0f3c
commit
14e6823c7c
@ -8,7 +8,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $Header: /cvsroot/pgsql/src/backend/libpq/ip.c,v 1.5 2003/04/02 20:00:21 tgl Exp $
|
* $Header: /cvsroot/pgsql/src/backend/libpq/ip.c,v 1.6 2003/04/03 21:50:23 tgl Exp $
|
||||||
*
|
*
|
||||||
* This file and the IPV6 implementation were initially provided by
|
* This file and the IPV6 implementation were initially provided by
|
||||||
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
|
* Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
|
||||||
@ -212,17 +212,10 @@ int
|
|||||||
SockAddr_pton(SockAddr *sa, const char *src)
|
SockAddr_pton(SockAddr *sa, const char *src)
|
||||||
{
|
{
|
||||||
int family = AF_INET;
|
int family = AF_INET;
|
||||||
#ifdef HAVE_IPV6
|
|
||||||
const char *ch;
|
|
||||||
|
|
||||||
for (ch = src; *ch != '\0'; ch++)
|
#ifdef HAVE_IPV6
|
||||||
{
|
if (strchr(src, ':'))
|
||||||
if (*ch == ':')
|
family = AF_INET6;
|
||||||
{
|
|
||||||
family = AF_INET6;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sa->sa.sa_family = family;
|
sa->sa.sa_family = family;
|
||||||
|
Loading…
Reference in New Issue
Block a user