Skip to content

Commit 6d97c86

Browse files
committed
Nuke the MGf_PERSIST flag, freeing a bit in ->mg_flags
The MGf_PERSIST flag is only used by PERL_MAGIC_lvref, and there it simply contains a shadow copy of the OPpLVREF_ITER flag in op_private. Since the mg_priv field is set as a copy of op_private anyway, the code that checks this bit might as well look there instead. As a result of this change, the 0x80 bit of the mg_flags field is now free for other purposes.
1 parent 52fdca7 commit 6d97c86

File tree

3 files changed

+1
-4
lines changed

3 files changed

+1
-4
lines changed

mg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2899,7 +2899,7 @@ Perl_magic_setlvref(pTHX_ SV *sv, MAGIC *mg)
28992899
(void)hv_store_ent((HV *)mg->mg_obj, (SV *)mg->mg_ptr,
29002900
SvREFCNT_inc_simple_NN(SvRV(sv)), 0);
29012901
}
2902-
if (mg->mg_flags & MGf_PERSIST)
2902+
if (mg->mg_private & OPpLVREF_ITER)
29032903
NOOP; /* This sv is in use as an iterator var and will be reused,
29042904
so we must leave the magic. */
29052905
else

mg.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ struct magic {
4040
#define MGf_DUP 0x10 /* has an svt_dup MGVTBL entry */
4141
#define MGf_LOCAL 0x20 /* has an svt_local MGVTBL entry */
4242
#define MGf_BYTES 0x40 /* PERL_MAGIC_regex_global only */
43-
#define MGf_PERSIST 0x80 /* PERL_MAGIC_lvref only */
4443

4544
#define MgTAINTEDDIR(mg) (mg->mg_flags & MGf_TAINTEDDIR)
4645
#define MgTAINTEDDIR_on(mg) (mg->mg_flags |= MGf_TAINTEDDIR)

pp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7598,8 +7598,6 @@ PP_wrapped(pp_lvref,
75987598
&PL_vtbl_lvref, (char *)elem,
75997599
elem ? HEf_SVKEY : (I32)ARGTARG);
76007600
mg->mg_private = PL_op->op_private;
7601-
if (PL_op->op_private & OPpLVREF_ITER)
7602-
mg->mg_flags |= MGf_PERSIST;
76037601
if (UNLIKELY(PL_op->op_private & OPpLVAL_INTRO)) {
76047602
if (elem) {
76057603
assert(arg);

0 commit comments

Comments
 (0)