diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-04-28 00:18:30 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-12-09 18:47:20 -0800 |
commit | c58b680b06b94939ee921d7062cd14927136ae30 (patch) | |
tree | e8012ebb94b4e9a7bee7bfebc5f073744237b7f9 | |
parent | 9423a867e1bcf854b0ed9fff9eacaadd6f48ca8d (diff) | |
download | perl-c58b680b06b94939ee921d7062cd14927136ae30.tar.gz |
Stop using PL_glob_index for PL_globhook
If Glob.xs just uses the address of PL_op as its iterator key all the
time (when called via PL_globhook too, not just via a glob override),
the code is simpler.
-rw-r--r-- | ext/File-Glob/Glob.xs | 12 | ||||
-rw-r--r-- | op.c | 3 | ||||
-rw-r--r-- | pp_sys.c | 4 |
3 files changed, 2 insertions, 17 deletions
diff --git a/ext/File-Glob/Glob.xs b/ext/File-Glob/Glob.xs index 252c2eddb0..50bb2daacf 100644 --- a/ext/File-Glob/Glob.xs +++ b/ext/File-Glob/Glob.xs @@ -67,17 +67,13 @@ iterate(pTHX_ bool(*globber)(pTHX_ AV *entries, SV *patsv)) dSP; dMY_CXT; - SV * const cxixsv = POPs; - const char *cxixpv; - STRLEN cxixlen; + const char * const cxixpv = (char *)&PL_op; + STRLEN const cxixlen = sizeof(OP *); AV *entries; U32 const gimme = GIMME_V; SV *patsv = POPs; bool on_stack = FALSE; - SvGETMAGIC(cxixsv); - cxixpv = SvPV_nomg(cxixsv, cxixlen); - if (!MY_CXT.x_GLOB_ENTRIES) MY_CXT.x_GLOB_ENTRIES = newHV(); entries = (AV *)*(hv_fetch(MY_CXT.x_GLOB_ENTRIES, cxixpv, cxixlen, 1)); @@ -359,8 +355,6 @@ PPCODE: else { XPUSHs(&PL_sv_undef); } - XPUSHs(newSVpvn_flags((char *)&PL_op, sizeof(OP *), SVs_TEMP)); - sv_catpvs(*SP, "_"); /* Avoid conflicts with PL_glob_index */ PUTBACK; csh_glob_iter(aTHX); SPAGAIN; @@ -372,8 +366,6 @@ PPCODE: else { XPUSHs(&PL_sv_undef); } - XPUSHs(newSVpvn_flags((char *)&PL_op, sizeof(OP *), SVs_TEMP)); - sv_catpvs(*SP, "_"); /* Avoid conflicts with PL_glob_index */ PUTBACK; iterate(aTHX_ doglob_iter_wrapper); SPAGAIN; @@ -9005,9 +9005,6 @@ Perl_ck_glob(pTHX_ OP *o) gv = (GV *)newSV(0); gv_init(gv, 0, "", 0, 0); gv_IOadd(gv); -#ifndef PERL_EXTERNAL_GLOB - sv_setiv(GvSVn(gv),PL_glob_index++); -#endif op_append_elem(OP_GLOB, o, newGVOP(OP_GV, 0, gv)); SvREFCNT_dec_NN(gv); /* newGVOP increased it */ scalarkids(o); @@ -376,11 +376,7 @@ PP(pp_glob) * */ return NORMAL; } - /* stack args are: wildcard, gv(_GEN_n) */ - if (PL_globhook) { - PUSHs(GvSV(gv)); - PUTBACK; PL_globhook(aTHX); return NORMAL; } |