summaryrefslogtreecommitdiff
path: root/toke.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-08-05 00:36:50 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-08-05 02:23:34 -0700
commit05c9917c892c03577828027ff71c6282a2eabe29 (patch)
tree9788a1d70a9b84e9ed5ce4786352059dddd82146 /toke.c
parent38bd7ad824475827a398201ca9ae79a9b2b70c50 (diff)
downloadperl-05c9917c892c03577828027ff71c6282a2eabe29.tar.gz
toke.c:incline: Avoid duplicate symbol lookup
If we have already looked up the GV for *{"_<newfilename"}, we can set CopFILEGV to that instead of having CopFILE_setn look it up itself.
Diffstat (limited to 'toke.c')
-rw-r--r--toke.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/toke.c b/toke.c
index 7033bc6ed6..0de2d0c484 100644
--- a/toke.c
+++ b/toke.c
@@ -1754,6 +1754,7 @@ S_incline(pTHX_ const char *s)
if (t - s > 0) {
const STRLEN len = t - s;
GV * const cfgv = CopFILEGV(PL_curcop);
+ GV *gv2 = NULL;
if (cfgv && !PL_rsfp && !PL_parser->filtered) {
/* must copy *{"::_<(eval N)[oldfilename:L]"}
@@ -1763,7 +1764,6 @@ S_incline(pTHX_ const char *s)
char smallbuf[128];
STRLEN tmplen2 = len;
char *tmpbuf2;
- GV *gv2;
if (tmplen2 + 2 <= sizeof smallbuf)
tmpbuf2 = smallbuf;
@@ -1805,7 +1805,8 @@ S_incline(pTHX_ const char *s)
if (tmpbuf2 != smallbuf) Safefree(tmpbuf2);
}
CopFILE_free(PL_curcop);
- CopFILE_setn(PL_curcop, s, len);
+ if (gv2) CopFILEGV_set(PL_curcop, gv2);
+ else CopFILE_setn(PL_curcop, s, len);
}
CopLINE_set(PL_curcop, line_num);
}