In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/492254706dd070a67dab2799fba515e6e4c3a3bb?hp=5f42d1f26e3387cc85f8ac2f3b8131c06f7c9dd0>
- Log ----------------------------------------------------------------- commit 492254706dd070a67dab2799fba515e6e4c3a3bb Author: Daniel Dragan <[email protected]> Date: Tue Dec 24 05:04:55 2013 -0500 pp_sys.c remove null checks and locality pp_enterwrite, EXTEND contains a funccall, dont save gv around it pp_ioctl, move optype to first place used to reduce liveness M pp_sys.c commit 5805b5855c54176df1831b2fbbb0fae5dc2d52ad Author: Father Chrysostomos <[email protected]> Date: Tue Dec 24 05:44:01 2013 -0800 pp_sys.c: More null check removal Thanks again to Daniel Dragan for pointing out candidates in <[email protected]> (ticket #120842). M pp_sys.c commit ceaf124e025eb0db6ee6049129591ceec9f38b6e Author: Father Chrysostomos <[email protected]> Date: Mon Dec 23 22:48:10 2013 -0800 Interpret do CORE() as do-file a96df64385 inadvertently changed it. do-file is how it has alwas been interpreted, at least as far back as 5.000, as far as I can tell. M t/op/do.t M toke.c ----------------------------------------------------------------------- Summary of changes: pp_sys.c | 21 ++++++++------------- t/op/do.t | 10 ++++++++++ toke.c | 3 ++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/pp_sys.c b/pp_sys.c index 1ae1119..adcf76b 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -686,10 +686,10 @@ PP(pp_pipe_op) assert (isGV_with_GP(rgv)); assert (isGV_with_GP(wgv)); rstio = GvIOn(rgv); - wstio = GvIOn(wgv); - if (IoIFP(rstio)) do_close(rgv, FALSE); + + wstio = GvIOn(wgv); if (IoIFP(wstio)) do_close(wgv, FALSE); @@ -1378,8 +1378,8 @@ PP(pp_enterwrite) SV *tmpsv = NULL; if (MAXARG == 0) { - gv = PL_defoutgv; EXTEND(SP, 1); + gv = PL_defoutgv; } else { gv = MUTABLE_GV(POPs); @@ -2264,7 +2264,7 @@ PP(pp_ioctl) dVAR; dSP; dTARGET; SV * const argsv = POPs; const unsigned int func = POPu; - const int optype = PL_op->op_type; + int optype; GV * const gv = MUTABLE_GV(POPs); IO * const io = GvIOn(gv); char *s; @@ -2293,6 +2293,7 @@ PP(pp_ioctl) s = INT2PTR(char*,retval); /* ouch */ } + optype = PL_op->op_type; TAINT_PROPER(PL_op_desc[optype]); if (optype == OP_IOCTL) @@ -2371,15 +2372,9 @@ PP(pp_socket) const int type = POPi; const int domain = POPi; GV * const gv = MUTABLE_GV(POPs); - IO * const io = gv ? GvIOn(gv) : NULL; + IO * const io = GvIOn(gv); int fd; - if (!io) { - report_evil_fh(gv); - SETERRNO(EBADF,LIB_INVARG); - RETPUSHUNDEF; - } - if (IoIFP(io)) do_close(gv, FALSE); @@ -2601,7 +2596,7 @@ PP(pp_ssockopt) int fd; Sock_size_t len; - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; fd = PerlIO_fileno(IoIFP(io)); @@ -2671,7 +2666,7 @@ PP(pp_getpeername) SV *sv; int fd; - if (!io || !IoIFP(io)) + if (!IoIFP(io)) goto nuts; sv = sv_2mortal(newSV(257)); diff --git a/t/op/do.t b/t/op/do.t index aab6bbb..012166e 100644 --- a/t/op/do.t +++ b/t/op/do.t @@ -260,6 +260,16 @@ SKIP: { isnt $@, "scrimptious scrobblings", "It was interpreted as do-file"; } +# do CORE () has always been do-file +{ + my $called; + sub CORE { $called .= "fungible" } + $@ = "scromptious scrimblings"; + do CORE(); + is $called, "fungible", "do CORE() calls &CORE"; + isnt $@, "scromptious scrimblings", "It was interpreted as do-file"; +} + # do subname() and $subname() are no longer allowed { sub subname { fail('do subname('. ($_[0] || '') .') called') }; diff --git a/toke.c b/toke.c index b146cdc..ca306f1 100644 --- a/toke.c +++ b/toke.c @@ -7891,7 +7891,8 @@ Perl_yylex(pTHX) *PL_tokenbuf = '&'; d = scan_word(s, PL_tokenbuf + 1, sizeof PL_tokenbuf - 1, 1, &len); - if (len && !keyword(PL_tokenbuf + 1, len, 0)) { + if (len && (len != 4 || strNE(PL_tokenbuf+1, "CORE")) + && !keyword(PL_tokenbuf + 1, len, 0)) { d = SKIPSPACE1(d); if (*d == '(') { force_ident_maybe_lex('&'); -- Perl5 Master Repository
