summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-11-05 14:35:45 -0800
committerFather Chrysostomos <sprout@cpan.org>2013-11-06 05:56:03 -0800
commit9e3fb20c3e612686e655b7bb4d6982e3b565270a (patch)
tree85001b8405a42b516ee0f798c2ac7f607e906d44 /toke.c
parenta93a1bfd14dd3999c151fe1931d06a570700eb5c (diff)
downloadperl-9e3fb20c3e612686e655b7bb4d6982e3b565270a.tar.gz
Put common override code into gv_override
When I moved the three occurrences of this code in op.c into a static function, I did not realise at the time that it also occurred thre etimes in toke.c. So now it is in a new non-static function in gv.c. Only two of the instances in toke.c could be changed to use this func- tion, as the otherwise is a little different. I couldn’t see a simple way of factoring its requirements in.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/toke.c b/toke.c
index 63f79904c9..c19b446713 100644
--- a/toke.c
+++ b/toke.c
@@ -4483,17 +4483,7 @@ S_readpipe_override(pTHX)
GV **gvp;
GV *gv_readpipe = gv_fetchpvs("readpipe", GV_NOTQUAL, SVt_PVCV);
pl_yylval.ival = OP_BACKTICK;
- if ((gv_readpipe
- && GvCVu(gv_readpipe) && GvIMPORTED_CV(gv_readpipe))
- ||
- ((gvp = (GV**)hv_fetchs(PL_globalstash, "readpipe", FALSE))
- && (gv_readpipe = *gvp) && (
- isGV_with_GP(gv_readpipe)
- ? GvCVu(gv_readpipe) && GvIMPORTED_CV(gv_readpipe)
- : SvPCS_IMPORTED(gv_readpipe)
- && (gv_init(gv_readpipe, PL_globalstash, "readpipe",
- 8, 0), 1)
- )))
+ if ((gv_readpipe = gv_override("readpipe",8)))
{
COPLINE_SET_FROM_MULTI_END;
PL_lex_op = (OP*)newUNOP(OP_ENTERSUB, OPf_STACKED,
@@ -10431,17 +10421,7 @@ S_scan_inputsymbol(pTHX_ char *start)
/* Check whether readline() is overriden */
gv_readline = gv_fetchpvs("readline", GV_NOTQUAL, SVt_PVCV);
- if ((gv_readline
- && GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline))
- ||
- ((gvp = (GV**)hv_fetchs(PL_globalstash, "readline", FALSE))
- && (gv_readline = *gvp) && (
- isGV_with_GP(gv_readline)
- ? GvCVu(gv_readline) && GvIMPORTED_CV(gv_readline)
- : SvPCS_IMPORTED(gv_readline)
- && (gv_init(gv_readline, PL_globalstash,
- "readline", 8, 0), 1)
- )))
+ if ((gv_readline = gv_override("readline",8)))
readline_overriden = TRUE;
/* if <$fh>, create the ops to turn the variable into a