summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2010-04-17 20:11:49 +0100
committerNicholas Clark <nick@ccl4.org>2010-04-17 20:11:49 +0100
commit47550813adf9ff4023595a3d439a9080e8fa9040 (patch)
treebed592c9b0b741c08ea2271cecdb978285531ba6 /pp_ctl.c
parent651b8f1ab1a3f46ec28299b662077c511e8c2483 (diff)
downloadperl-47550813adf9ff4023595a3d439a9080e8fa9040.tar.gz
Fix RT #74290 - regression for labels immediately before string evals.
Fix location identified by Father Chrysostomos, who also offered a patch, but this patch is more efficient, as it avoids any allocation. Test code based on his test example.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index e766d7dde3..d62d58ada3 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3814,7 +3814,18 @@ PP(pp_entereval)
if (PL_compiling.cop_hints_hash) {
Perl_refcounted_he_free(aTHX_ PL_compiling.cop_hints_hash);
}
- PL_compiling.cop_hints_hash = PL_curcop->cop_hints_hash;
+ if (Perl_fetch_cop_label(aTHX_ PL_curcop->cop_hints_hash, NULL, NULL)) {
+ /* The label, if present, is the first entry on the chain. So rather
+ than writing a blank label in front of it (which involves an
+ allocation), just use the next entry in the chain. */
+ PL_compiling.cop_hints_hash
+ = PL_curcop->cop_hints_hash->refcounted_he_next;
+ /* Check the assumption that this removed the label. */
+ assert(Perl_fetch_cop_label(aTHX_ PL_compiling.cop_hints_hash, NULL,
+ NULL) == NULL);
+ }
+ else
+ PL_compiling.cop_hints_hash = PL_curcop->cop_hints_hash;
if (PL_compiling.cop_hints_hash) {
HINTS_REFCNT_LOCK;
PL_compiling.cop_hints_hash->refcounted_he_refcnt++;