In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/720d5dbf0d947286fddc718fa10dcc1b55949caf?hp=111d382d531b38ae57c1b946e9ab48608cf58309>
- Log ----------------------------------------------------------------- commit 720d5dbf0d947286fddc718fa10dcc1b55949caf Author: Nicholas Clark <n...@ccl4.org> Date: Mon Jan 10 11:54:28 2011 +0000 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. M opcode.h M pp_proto.h M pp_sys.c M regen/opcode.pl commit 396166e10147fc6b88509af7c63dd916a683a86c Author: Nicholas Clark <n...@ccl4.org> Date: Mon Jan 10 10:29:06 2011 +0000 Merge the implementations of pp_s{host,net,proto,serv}ent. M opcode.h M pp_proto.h M pp_sys.c M regen/opcode.pl commit d8ef1fcdce21e8d5905a1ed77bc1caa307b2b79e Author: Nicholas Clark <n...@ccl4.org> Date: Mon Jan 10 10:12:10 2011 +0000 Merge the implementations of pp_e{host,net,proto,serv}ent. PL_op_desc[] rather than PL_op_name(), as the OPs are internally named e*ent, but implement the ent*ent functions, and when unimplemented report themselves using the function name. No need for OP_DESC(), as the switch statement means that we can't encounter OP_CUSTOM. M opcode.h M pp_proto.h M pp_sys.c M regen/opcode.pl ----------------------------------------------------------------------- Summary of changes: opcode.h | 30 ++++++--- pp_proto.h | 10 --- pp_sys.c | 174 ++++++++++++++++++++++--------------------------------- regen/opcode.pl | 3 + 4 files changed, 93 insertions(+), 124 deletions(-) diff --git a/opcode.h b/opcode.h index 8cc671a..359b98e 100644 --- a/opcode.h +++ b/opcode.h @@ -121,10 +121,20 @@ #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 #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 @@ -1247,23 +1257,23 @@ 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, - Perl_pp_eprotoent, - Perl_pp_eservent, + Perl_pp_enetent, /* implemented by Perl_pp_ehostent */ + Perl_pp_eprotoent, /* implemented by Perl_pp_ehostent */ + Perl_pp_eservent, /* implemented by Perl_pp_ehostent */ 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 41f03e0..cb09bf1 100644 --- a/pp_proto.h +++ b/pp_proto.h @@ -50,9 +50,7 @@ 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_enetent(pTHX); PERL_CALLCONV OP *Perl_pp_enter(pTHX); PERL_CALLCONV OP *Perl_pp_entereval(pTHX); PERL_CALLCONV OP *Perl_pp_entergiven(pTHX); @@ -63,10 +61,7 @@ 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_eprotoent(pTHX); -PERL_CALLCONV OP *Perl_pp_epwent(pTHX); PERL_CALLCONV OP *Perl_pp_eq(pTHX); -PERL_CALLCONV OP *Perl_pp_eservent(pTHX); PERL_CALLCONV OP *Perl_pp_exec(pTHX); PERL_CALLCONV OP *Perl_pp_exists(pTHX); PERL_CALLCONV OP *Perl_pp_exit(pTHX); @@ -219,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); @@ -229,19 +223,15 @@ 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); diff --git a/pp_sys.c b/pp_sys.c index f8c50d6..a227369 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -4985,94 +4985,104 @@ 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) { -#ifdef HAS_ENDHOSTENT dVAR; dSP; - PerlSock_endhostent(); - EXTEND(SP,1); - RETPUSHYES; + switch(PL_op->op_type) { + case OP_EHOSTENT: +#ifdef HAS_ENDHOSTENT + PerlSock_endhostent(); #else - DIE(aTHX_ PL_no_sock_func, "endhostent"); + DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]); #endif -} - -PP(pp_enetent) -{ + break; + case OP_ENETENT: #ifdef HAS_ENDNETENT - dVAR; dSP; - PerlSock_endnetent(); - EXTEND(SP,1); - RETPUSHYES; + PerlSock_endnetent(); #else - DIE(aTHX_ PL_no_sock_func, "endnetent"); + DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]); #endif -} - -PP(pp_eprotoent) -{ + break; + case OP_EPROTOENT: #ifdef HAS_ENDPROTOENT - dVAR; dSP; - PerlSock_endprotoent(); - EXTEND(SP,1); - RETPUSHYES; + PerlSock_endprotoent(); #else - DIE(aTHX_ PL_no_sock_func, "endprotoent"); + DIE(aTHX_ PL_no_sock_func, PL_op_desc[PL_op->op_type]); #endif -} - -PP(pp_eservent) -{ + break; + case OP_ESERVENT: #ifdef HAS_ENDSERVENT - dVAR; dSP; - PerlSock_endservent(); - EXTEND(SP,1); - RETPUSHYES; + PerlSock_endservent(); #else - DIE(aTHX_ PL_no_sock_func, "endservent"); + 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; } PP(pp_gpwent) @@ -5308,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 @@ -5404,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 701ec27..9d314f2 100755 --- a/regen/opcode.pl +++ b/regen/opcode.pl @@ -117,6 +117,9 @@ 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 + spwent epwent sgrent egrent)], + Perl_pp_shostent => [qw(snetent sprotoent sservent)], ); while (my ($func, $names) = splice @raw_alias, 0, 2) { -- Perl5 Master Repository