summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-01-10 11:54:28 +0000
committerNicholas Clark <nick@ccl4.org>2011-01-10 11:54:28 +0000
commit720d5dbf0d947286fddc718fa10dcc1b55949caf (patch)
tree86774b9f32e24aba00ed60d62849ef7d56433f96
parent396166e10147fc6b88509af7c63dd916a683a86c (diff)
downloadperl-720d5dbf0d947286fddc718fa10dcc1b55949caf.tar.gz
Merge the implementations of {end,set}{gr,pw}ent with endhostent.
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.
-rw-r--r--opcode.h12
-rw-r--r--pp_proto.h4
-rw-r--r--pp_sys.c72
-rwxr-xr-xregen/opcode.pl3
4 files changed, 38 insertions, 53 deletions
diff --git a/opcode.h b/opcode.h
index 9a217bd9fe..359b98eca6 100644
--- a/opcode.h
+++ b/opcode.h
@@ -129,8 +129,12 @@
#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,
diff --git a/pp_proto.h b/pp_proto.h
index e21fe2c538..cb09bf1134 100644
--- a/pp_proto.h
+++ b/pp_proto.h
@@ -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);
diff --git a/pp_sys.c b/pp_sys.c
index fc3b2e6480..a227369d52 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -5052,6 +5052,34 @@ PP(pp_ehostent)
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;
}
EXTEND(SP,1);
RETPUSHYES;
@@ -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
diff --git a/regen/opcode.pl b/regen/opcode.pl
index 744fe3d256..9d314f21e0 100755
--- a/regen/opcode.pl
+++ b/regen/opcode.pl
@@ -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)],
);