Merge the implementations of {end,set}{gr,pw}ent with endhostent.
authorNicholas Clark <nick@ccl4.org>
Mon, 10 Jan 2011 11:54:28 +0000 (11:54 +0000)
committerNicholas Clark <nick@ccl4.org>
Mon, 10 Jan 2011 11:54:28 +0000 (11:54 +0000)
Unlike set{host,net,proto,serv}ent, set{gr,pw}ent don't have stayopen
parameter, hence their "signature" is the same as the ent*ent functions.

opcode.h
pp_proto.h
pp_sys.c
regen/opcode.pl

index 9a217bd..359b98e 100644 (file)
--- a/opcode.h
+++ b/opcode.h
 #define Perl_pp_eservent Perl_pp_ehostent
 #define Perl_pp_gpwnam Perl_pp_gpwent
 #define Perl_pp_gpwuid Perl_pp_gpwent
+#define Perl_pp_spwent Perl_pp_ehostent
+#define Perl_pp_epwent Perl_pp_ehostent
 #define Perl_pp_ggrnam Perl_pp_ggrent
 #define Perl_pp_ggrgid Perl_pp_ggrent
+#define Perl_pp_sgrent Perl_pp_ehostent
+#define Perl_pp_egrent Perl_pp_ehostent
 #define Perl_pp_custom Perl_unimplemented_op
 #define Perl_pp_reach Perl_pp_rkeys
 #define Perl_pp_rvalues Perl_pp_rkeys
@@ -1263,13 +1267,13 @@ EXT Perl_ppaddr_t PL_ppaddr[] /* or perlvars.h */
        Perl_pp_gpwnam, /* implemented by Perl_pp_gpwent */
        Perl_pp_gpwuid, /* implemented by Perl_pp_gpwent */
        Perl_pp_gpwent,
-       Perl_pp_spwent,
-       Perl_pp_epwent,
+       Perl_pp_spwent, /* implemented by Perl_pp_ehostent */
+       Perl_pp_epwent, /* implemented by Perl_pp_ehostent */
        Perl_pp_ggrnam, /* implemented by Perl_pp_ggrent */
        Perl_pp_ggrgid, /* implemented by Perl_pp_ggrent */
        Perl_pp_ggrent,
-       Perl_pp_sgrent,
-       Perl_pp_egrent,
+       Perl_pp_sgrent, /* implemented by Perl_pp_ehostent */
+       Perl_pp_egrent, /* implemented by Perl_pp_ehostent */
        Perl_pp_getlogin,
        Perl_pp_syscall,
        Perl_pp_lock,
index e21fe2c..cb09bf1 100644 (file)
@@ -50,7 +50,6 @@ PERL_CALLCONV OP *Perl_pp_delete(pTHX);
 PERL_CALLCONV OP *Perl_pp_die(pTHX);
 PERL_CALLCONV OP *Perl_pp_divide(pTHX);
 PERL_CALLCONV OP *Perl_pp_each(pTHX);
-PERL_CALLCONV OP *Perl_pp_egrent(pTHX);
 PERL_CALLCONV OP *Perl_pp_ehostent(pTHX);
 PERL_CALLCONV OP *Perl_pp_enter(pTHX);
 PERL_CALLCONV OP *Perl_pp_entereval(pTHX);
@@ -62,7 +61,6 @@ PERL_CALLCONV OP *Perl_pp_entertry(pTHX);
 PERL_CALLCONV OP *Perl_pp_enterwhen(pTHX);
 PERL_CALLCONV OP *Perl_pp_enterwrite(pTHX);
 PERL_CALLCONV OP *Perl_pp_eof(pTHX);
-PERL_CALLCONV OP *Perl_pp_epwent(pTHX);
 PERL_CALLCONV OP *Perl_pp_eq(pTHX);
 PERL_CALLCONV OP *Perl_pp_exec(pTHX);
 PERL_CALLCONV OP *Perl_pp_exists(pTHX);
@@ -216,7 +214,6 @@ PERL_CALLCONV OP *Perl_pp_semget(pTHX);
 PERL_CALLCONV OP *Perl_pp_seq(pTHX);
 PERL_CALLCONV OP *Perl_pp_setpgrp(pTHX);
 PERL_CALLCONV OP *Perl_pp_setpriority(pTHX);
-PERL_CALLCONV OP *Perl_pp_sgrent(pTHX);
 PERL_CALLCONV OP *Perl_pp_shift(pTHX);
 PERL_CALLCONV OP *Perl_pp_shmwrite(pTHX);
 PERL_CALLCONV OP *Perl_pp_shostent(pTHX);
@@ -232,7 +229,6 @@ 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_spwent(pTHX);
 PERL_CALLCONV OP *Perl_pp_srand(pTHX);
 PERL_CALLCONV OP *Perl_pp_srefgen(pTHX);
 PERL_CALLCONV OP *Perl_pp_sselect(pTHX);
index fc3b2e6..a227369 100644 (file)
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -5050,6 +5050,34 @@ PP(pp_ehostent)
        PerlSock_endservent();
 #else
        DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]);
+#endif
+       break;
+    case OP_SGRENT:
+#if defined(HAS_GROUP) && defined(HAS_SETGRENT)
+       setgrent();
+#else
+       DIE(aTHX_ PL_no_func, PL_op_desc[PL_op->op_type]);
+#endif
+       break;
+    case OP_EGRENT:
+#if defined(HAS_GROUP) && defined(HAS_ENDGRENT)
+       endgrent();
+#else
+       DIE(aTHX_ PL_no_func, PL_op_desc[PL_op->op_type]);
+#endif
+       break;
+    case OP_SPWENT:
+#if defined(HAS_PASSWD) && defined(HAS_SETPWENT)
+       setpwent();
+#else
+       DIE(aTHX_ PL_no_func, PL_op_desc[PL_op->op_type]);
+#endif
+       break;
+    case OP_EPWENT:
+#if defined(HAS_PASSWD) && defined(HAS_ENDPWENT)
+       endpwent();
+#else
+       DIE(aTHX_ PL_no_func, PL_op_desc[PL_op->op_type]);
 #endif
        break;
     }
@@ -5290,28 +5318,6 @@ PP(pp_gpwent)
 #endif
 }
 
-PP(pp_spwent)
-{
-#if defined(HAS_PASSWD) && defined(HAS_SETPWENT)
-    dVAR; dSP;
-    setpwent();
-    RETPUSHYES;
-#else
-    DIE(aTHX_ PL_no_func, "setpwent");
-#endif
-}
-
-PP(pp_epwent)
-{
-#if defined(HAS_PASSWD) && defined(HAS_ENDPWENT)
-    dVAR; dSP;
-    endpwent();
-    RETPUSHYES;
-#else
-    DIE(aTHX_ PL_no_func, "endpwent");
-#endif
-}
-
 PP(pp_ggrent)
 {
 #ifdef HAS_GROUP
@@ -5386,28 +5392,6 @@ PP(pp_ggrent)
 #endif
 }
 
-PP(pp_sgrent)
-{
-#if defined(HAS_GROUP) && defined(HAS_SETGRENT)
-    dVAR; dSP;
-    setgrent();
-    RETPUSHYES;
-#else
-    DIE(aTHX_ PL_no_func, "setgrent");
-#endif
-}
-
-PP(pp_egrent)
-{
-#if defined(HAS_GROUP) && defined(HAS_ENDGRENT)
-    dVAR; dSP;
-    endgrent();
-    RETPUSHYES;
-#else
-    DIE(aTHX_ PL_no_func, "endgrent");
-#endif
-}
-
 PP(pp_getlogin)
 {
 #ifdef HAS_GETLOGIN
index 744fe3d..9d314f2 100755 (executable)
@@ -117,7 +117,8 @@ my @raw_alias = (
                 Perl_pp_predec => ['i_predec'],
                 Perl_pp_postinc => ['i_postinc'],
                 Perl_pp_postdec => ['i_postdec'],
-                Perl_pp_ehostent => [qw(enetent eprotoent eservent)],
+                Perl_pp_ehostent => [qw(enetent eprotoent eservent
+                                        spwent epwent sgrent egrent)],
                 Perl_pp_shostent => [qw(snetent sprotoent sservent)],
                );