summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-02 11:17:58 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-02 11:17:58 +0000
commit623e66097f3d3c76e4fbfed49657029a98953c17 (patch)
tree4304a16273ac0891e56eafbcf6a80baef63a7fdb
parent38ab35f8085a56081a4dbd8b974815dee28ebfd1 (diff)
downloadperl-623e66097f3d3c76e4fbfed49657029a98953c17.tar.gz
Abstract all reads/writes of the hints in COPs with 2 new macros,
CopHINTS_get() and CopHINTS_set(). p4raw-id: //depot/perl@27677
-rw-r--r--cop.h7
-rw-r--r--op.c8
-rw-r--r--pp_ctl.c5
-rw-r--r--utf8.c4
4 files changed, 15 insertions, 9 deletions
diff --git a/cop.h b/cop.h
index da9fd5b689..fc69b916fe 100644
--- a/cop.h
+++ b/cop.h
@@ -234,6 +234,13 @@ struct cop {
#define CopARYBASE_get(c) ((c)->cop_arybase + 0)
#define CopARYBASE_set(c, b) STMT_START { (c)->cop_arybase = (b); } STMT_END
+/* FIXME NATIVE_HINTS if this is changed from op_private (see perl.h) */
+#define CopHINTS_get(c) ((c)->op_private + 0)
+#define CopHINTS_set(c, h) STMT_START { \
+ (c)->op_private \
+ = (U8)((h) & HINT_PRIVATE_MASK); \
+ } STMT_END
+
/*
* Here we have some enormously heavy (or at least ponderous) wizardry.
*/
diff --git a/op.c b/op.c
index 130daf9809..fa84b938ee 100644
--- a/op.c
+++ b/op.c
@@ -2003,7 +2003,7 @@ Perl_block_end(pTHX_ I32 floor, OP *seq)
const int needblockscope = PL_hints & HINT_BLOCK_SCOPE;
OP* const retval = scalarseq(seq);
LEAVE_SCOPE(floor);
- PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+ CopHINTS_set(&PL_compiling, PL_hints);
if (needblockscope)
PL_hints |= HINT_BLOCK_SCOPE; /* propagate out */
pad_leavemy();
@@ -3931,11 +3931,11 @@ Perl_newSTATEOP(pTHX_ I32 flags, char *label, OP *o)
cop->op_ppaddr = PL_ppaddr[ OP_NEXTSTATE ];
}
cop->op_flags = (U8)flags;
- cop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+ CopHINTS_set(cop, PL_hints);
#ifdef NATIVE_HINTS
cop->op_private |= NATIVE_HINTS;
#endif
- PL_compiling.op_private = cop->op_private;
+ CopHINTS_set(&PL_compiling, CopHINTS_get(cop));
cop->op_next = (OP*)cop;
if (label) {
@@ -5333,7 +5333,7 @@ Perl_newATTRSUB(pTHX_ I32 floor, OP *o, OP *proto, OP *attrs, OP *block)
call_list(oldscope, PL_beginav);
PL_curcop = &PL_compiling;
- PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+ CopHINTS_set(&PL_compiling, PL_hints);
LEAVE;
}
else if (strEQ(s, "END") && !PL_error_count) {
diff --git a/pp_ctl.c b/pp_ctl.c
index 4b099d453c..26c4ea1826 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1695,8 +1695,7 @@ PP(pp_caller)
/* XXX only hints propagated via op_private are currently
* visible (others are not easily accessible, since they
* use the global PL_hints) */
- PUSHs(sv_2mortal(newSViv((I32)cx->blk_oldcop->op_private &
- HINT_PRIVATE_MASK)));
+ PUSHs(sv_2mortal(newSViv(CopHINTS_get(cx->blk_oldcop))));
{
SV * mask ;
SV * const old_warnings = cx->blk_oldcop->cop_warnings ;
@@ -2815,7 +2814,7 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
*padp = (AV*)SvREFCNT_inc_simple(PL_comppad);
LEAVE;
if (IN_PERL_COMPILETIME)
- PL_compiling.op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+ CopHINTS_set(&PL_compiling, PL_hints);
#ifdef OP_IN_REGISTER
op = PL_opsave;
#endif
diff --git a/utf8.c b/utf8.c
index 1e39edc0ef..f3b7a3b52c 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1609,7 +1609,7 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
const char* const pv = SvPV_const(tokenbufsv, len);
Copy(pv, PL_tokenbuf, len+1, char);
- PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+ CopHINTS_set(PL_curcop, PL_hints);
}
if (!SvROK(retval) || SvTYPE(SvRV(retval)) != SVt_PVHV) {
if (SvPOK(retval))
@@ -1710,7 +1710,7 @@ Perl_swash_fetch(pTHX_ SV *swash, const U8 *ptr, bool do_utf8)
needents);
if (IN_PERL_COMPILETIME)
- PL_curcop->op_private = (U8)(PL_hints & HINT_PRIVATE_MASK);
+ CopHINTS_set(PL_curcop, PL_hints);
svp = hv_store(hv, (const char *)ptr, klen, swatch, 0);