]> granicus.if.org Git - postgresql/commitdiff
Don't re-invent the strchr() wheel.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 Apr 2003 21:50:23 +0000 (21:50 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 3 Apr 2003 21:50:23 +0000 (21:50 +0000)
src/backend/libpq/ip.c

index 74096c41926d9c9e3ddc22bdbfb24570b6ec5e22..009887b269a2fe1636afa977dca1a52f076114c5 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * 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
  * Nigel Kukard <nkukard@lbsd.net>, Linux Based Systems Design
@@ -212,17 +212,10 @@ int
 SockAddr_pton(SockAddr *sa, const char *src)
 {
        int                     family = AF_INET;
-#ifdef HAVE_IPV6
-       const char              *ch;
 
-       for (ch = src; *ch != '\0'; ch++)
-       {
-               if (*ch == ':')
-               {
-                       family = AF_INET6;
-                       break;
-               }
-       }
+#ifdef HAVE_IPV6
+       if (strchr(src, ':'))
+               family = AF_INET6;
 #endif
 
        sa->sa.sa_family = family;