Merge the implementations of pp_s{host,net,proto,serv}ent.
authorNicholas Clark <nick@ccl4.org>
Mon, 10 Jan 2011 10:29:06 +0000 (10:29 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 10 Jan 2011 11:39:34 +0000 (11:39 +0000)
opcode.h
pp_proto.h
pp_sys.c
regen/opcode.pl

index 0f5954f..9a217bd 100644 (file)
--- a/opcode.h
+++ b/opcode.h
 #define Perl_pp_gpbynumber Perl_pp_gprotoent
 #define Perl_pp_gsbyname Perl_pp_gservent
 #define Perl_pp_gsbyport Perl_pp_gservent
+#define Perl_pp_snetent Perl_pp_shostent
+#define Perl_pp_sprotoent Perl_pp_shostent
+#define Perl_pp_sservent Perl_pp_shostent
 #define Perl_pp_enetent Perl_pp_ehostent
 #define Perl_pp_eprotoent Perl_pp_ehostent
 #define Perl_pp_eservent Perl_pp_ehostent
@@ -1250,9 +1253,9 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
        Perl_pp_gsbyport,       /* implemented by Perl_pp_gservent */
        Perl_pp_gservent,
        Perl_pp_shostent,
-       Perl_pp_snetent,
-       Perl_pp_sprotoent,
-       Perl_pp_sservent,
+       Perl_pp_snetent,        /* implemented by Perl_pp_shostent */
+       Perl_pp_sprotoent,      /* implemented by Perl_pp_shostent */
+       Perl_pp_sservent,       /* implemented by Perl_pp_shostent */
        Perl_pp_ehostent,
        Perl_pp_enetent,        /* implemented by Perl_pp_ehostent */
        Perl_pp_eprotoent,      /* implemented by Perl_pp_ehostent */
index 0585536..e21fe2c 100644 (file)
@@ -226,19 +226,16 @@ PERL_CALLCONV OP *Perl_pp_sle(pTHX);
 PERL_CALLCONV OP *Perl_pp_sleep(pTHX);
 PERL_CALLCONV OP *Perl_pp_smartmatch(pTHX);
 PERL_CALLCONV OP *Perl_pp_sne(pTHX);
-PERL_CALLCONV OP *Perl_pp_snetent(pTHX);
 PERL_CALLCONV OP *Perl_pp_socket(pTHX);
 PERL_CALLCONV OP *Perl_pp_sockpair(pTHX);
 PERL_CALLCONV OP *Perl_pp_sort(pTHX);
 PERL_CALLCONV OP *Perl_pp_splice(pTHX);
 PERL_CALLCONV OP *Perl_pp_split(pTHX);
 PERL_CALLCONV OP *Perl_pp_sprintf(pTHX);
-PERL_CALLCONV OP *Perl_pp_sprotoent(pTHX);
 PERL_CALLCONV OP *Perl_pp_spwent(pTHX);
 PERL_CALLCONV OP *Perl_pp_srand(pTHX);
 PERL_CALLCONV OP *Perl_pp_srefgen(pTHX);
 PERL_CALLCONV OP *Perl_pp_sselect(pTHX);
-PERL_CALLCONV OP *Perl_pp_sservent(pTHX);
 PERL_CALLCONV OP *Perl_pp_ssockopt(pTHX);
 PERL_CALLCONV OP *Perl_pp_stat(pTHX);
 PERL_CALLCONV OP *Perl_pp_stringify(pTHX);
index 7359f95..fc3b2e6 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -4985,46 +4985,39 @@ PP(pp_gservent)
 
 PP(pp_shostent)
 {
-#ifdef HAS_SETHOSTENT
     dVAR; dSP;
-    PerlSock_sethostent(TOPi);
-    RETSETYES;
+    const int stayopen = TOPi;
+    switch(PL_op->op_type) {
+    case OP_SHOSTENT:
+#ifdef HAS_SETHOSTENT
+       PerlSock_sethostent(stayopen);
 #else
-    DIE(aTHX_ PL_no_sock_func, "sethostent");
+       DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]);
 #endif
-}
-
-PP(pp_snetent)
-{
+       break;
 #ifdef HAS_SETNETENT
-    dVAR; dSP;
-    (void)PerlSock_setnetent(TOPi);
-    RETSETYES;
+    case OP_SNETENT:
+       PerlSock_setnetent(stayopen);
 #else
-    DIE(aTHX_ PL_no_sock_func, "setnetent");
+       DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]);
 #endif
-}
-
-PP(pp_sprotoent)
-{
+       break;
+    case OP_SPROTOENT:
 #ifdef HAS_SETPROTOENT
-    dVAR; dSP;
-    (void)PerlSock_setprotoent(TOPi);
-    RETSETYES;
+       PerlSock_setprotoent(stayopen);
 #else
-    DIE(aTHX_ PL_no_sock_func, "setprotoent");
+       DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]);
 #endif
-}
-
-PP(pp_sservent)
-{
+       break;
+    case OP_SSERVENT:
 #ifdef HAS_SETSERVENT
-    dVAR; dSP;
-    (void)PerlSock_setservent(TOPi);
-    RETSETYES;
+       PerlSock_setservent(stayopen);
 #else
-    DIE(aTHX_ PL_no_sock_func, "setservent");
+       DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]);
 #endif
+       break;
+    }
+    RETSETYES;
 }
 
 PP(pp_ehostent)
index 2d58450..744fe3d 100755 (executable)
@@ -118,6 +118,7 @@ my @raw_alias = (
                 Perl_pp_postinc => ['i_postinc'],
                 Perl_pp_postdec => ['i_postdec'],
                 Perl_pp_ehostent => [qw(enetent eprotoent eservent)],
+                Perl_pp_shostent => [qw(snetent sprotoent sservent)],
                );
 
 while (my ($func, $names) = splice @raw_alias, 0, 2) {