]> granicus.if.org Git - php/commitdiff
- Replaced calls to getprotobyname by constants to avoid
authorGustavo André dos Santos Lopes <cataphract@php.net>
Thu, 17 Mar 2011 22:21:59 +0000 (22:21 +0000)
committerGustavo André dos Santos Lopes <cataphract@php.net>
Thu, 17 Mar 2011 22:21:59 +0000 (22:21 +0000)
  unnecessarily hitting /etc/protocols on MINIT.

ext/sockets/sockets.c

index a180c86c6e83f90d4893b0e7c5425c2dcbd43c13..421e01c9ae98ce4b3c7de6d234f827e9eb712b3d 100644 (file)
@@ -815,14 +815,9 @@ PHP_MINIT_FUNCTION(sockets)
 #if HAVE_IPV6
        REGISTER_LONG_CONSTANT("IPPROTO_IPV6",  IPPROTO_IPV6,   CONST_CS | CONST_PERSISTENT);
 #endif
-       
-       if ((pe = getprotobyname("tcp"))) {
-               REGISTER_LONG_CONSTANT("SOL_TCP", pe->p_proto, CONST_CS | CONST_PERSISTENT);
-       }
 
-       if ((pe = getprotobyname("udp"))) {
-               REGISTER_LONG_CONSTANT("SOL_UDP", pe->p_proto, CONST_CS | CONST_PERSISTENT);
-       }
+       REGISTER_LONG_CONSTANT("SOL_TCP",               IPPROTO_TCP,    CONST_CS | CONST_PERSISTENT);
+       REGISTER_LONG_CONSTANT("SOL_UDP",               IPPROTO_UDP,    CONST_CS | CONST_PERSISTENT);
 
        return SUCCESS;
 }