summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-04-07 14:45:33 +0000
committerNicholas Clark <nick@ccl4.org>2008-04-07 14:45:33 +0000
commit012da8e581e60270322b8deba22fdfab9df5db1b (patch)
tree6bd43c09e3a595b66dc0f4d11d83c3d42cdd55a0 /op.c
parentdca6062a863d0e957d067cc75f9e13b2e28b1090 (diff)
downloadperl-012da8e581e60270322b8deba22fdfab9df5db1b.tar.gz
Split out S_refcounted_he_new_common() from
Perl_refcounted_he_new_common(), so that Perl_store_cop_label() can call it without needing to create two temporary SVs. Use it in newSTATEOP() and eliminate the two temporary SVs. Make Perl_fetch_cop_label() more defensive by not assuming that the value for ":" is always a PV. Remove its "compatibility" macro. p4raw-id: //depot/perl@33657
Diffstat (limited to 'op.c')
-rw-r--r--op.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/op.c b/op.c
index 3997facb72..11b29d8e1d 100644
--- a/op.c
+++ b/op.c
@@ -4380,20 +4380,14 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o)
HINTS_REFCNT_UNLOCK;
}
if (label) {
- /* Proof of concept for now - for efficiency reasons these are likely
- to end up being replaced by a custom function in hv.c */
- SV *const key = newSVpvs(":");
- SV *const value = newSVpv(label, 0);
cop->cop_hints_hash
- = Perl_refcounted_he_new(aTHX_ cop->cop_hints_hash, key, value);
+ = Perl_store_cop_label(aTHX_ cop->cop_hints_hash, label);
PL_hints |= HINT_BLOCK_SCOPE;
/* It seems that we need to defer freeing this pointer, as other parts
of the grammar end up wanting to copy it after this op has been
created. */
SAVEFREEPV(label);
- SvREFCNT_dec(key);
- SvREFCNT_dec(value);
}
if (PL_parser && PL_parser->copline == NOLINE)