Change 27677 by [EMAIL PROTECTED] on 2006/04/02 11:17:58

        Abstract all reads/writes of the hints in COPs with 2 new macros,
        CopHINTS_get() and CopHINTS_set().

Affected files ...

... //depot/perl/cop.h#113 edit
... //depot/perl/op.c#795 edit
... //depot/perl/pp_ctl.c#540 edit
... //depot/perl/utf8.c#281 edit

Differences ...

==== //depot/perl/cop.h#113 (text) ====
Index: perl/cop.h
--- perl/cop.h#112~27671~       2006-04-02 03:08:04.000000000 -0700
+++ perl/cop.h  2006-04-02 04:17:58.000000000 -0700
@@ -234,6 +234,13 @@
 #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.
  */

==== //depot/perl/op.c#795 (text) ====
Index: perl/op.c
--- perl/op.c#794~27671~        2006-04-02 03:08:04.000000000 -0700
+++ perl/op.c   2006-04-02 04:17:58.000000000 -0700
@@ -2003,7 +2003,7 @@
     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 @@
        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 @@
            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) {

==== //depot/perl/pp_ctl.c#540 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#539~27671~    2006-04-02 03:08:04.000000000 -0700
+++ perl/pp_ctl.c       2006-04-02 04:17:58.000000000 -0700
@@ -1695,8 +1695,7 @@
     /* 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 @@
     *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

==== //depot/perl/utf8.c#281 (text) ====
Index: perl/utf8.c
--- perl/utf8.c#280~27641~      2006-03-31 04:30:31.000000000 -0800
+++ perl/utf8.c 2006-04-02 04:17:58.000000000 -0700
@@ -1609,7 +1609,7 @@
        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 @@
                                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);
 
End of Patch.

Reply via email to