In op.c, change S_Slab_to_rw() from an OP * parameter to an OPSLAB *.
authorNicholas Clark <nick@ccl4.org>
Tue, 14 Aug 2012 12:24:34 +0000 (14:24 +0200)
committerNicholas Clark <nick@ccl4.org>
Tue, 4 Sep 2012 09:08:38 +0000 (11:08 +0200)
This makes it consistent with Perl_Slab_to_ro(), which takes an OPSLAB *.

embed.fnc
op.c
proto.h

index f547316..cb26c72 100644 (file)
--- a/embed.fnc
+++ b/embed.fnc
@@ -1803,7 +1803,7 @@ poxM      |OP *   |op_refcnt_inc  |NULLOK OP *o
 : FIXME - can be static.
 poxM   |PADOFFSET      |op_refcnt_dec  |NN OP *o
 #    if defined(PERL_IN_OP_C)
-s      |void   |Slab_to_rw     |NN void *op
+s      |void   |Slab_to_rw     |NN OPSLAB *const slab
 #    endif
 #endif
 
diff --git a/op.c b/op.c
index 1af16f7..8beb0fe 100644 (file)
--- a/op.c
+++ b/op.c
@@ -262,17 +262,12 @@ Perl_Slab_to_ro(pTHX_ OPSLAB *slab)
 }
 
 STATIC void
-S_Slab_to_rw(pTHX_ void *op)
+S_Slab_to_rw(pTHX_ OPSLAB *const slab)
 {
-    OP * const o = (OP *)op;
-    OPSLAB *slab;
     OPSLAB *slab2;
 
     PERL_ARGS_ASSERT_SLAB_TO_RW;
 
-    if (!o->op_slabbed) return;
-
-    slab = OpSLAB(o);
     if (!slab->opslab_readonly) return;
     slab2 = slab;
     for (; slab2; slab2 = slab2->opslab_next) {
@@ -408,7 +403,7 @@ Perl_op_refcnt_inc(pTHX_ OP *o)
     if(o) {
         OPSLAB *const slab = o->op_slabbed ? OpSLAB(o) : NULL;
         if (slab && slab->opslab_readonly) {
-            Slab_to_rw(o);
+            Slab_to_rw(slab);
             ++o->op_targ;
             Slab_to_ro(slab);
         } else {
@@ -428,7 +423,7 @@ Perl_op_refcnt_dec(pTHX_ OP *o)
     PERL_ARGS_ASSERT_OP_REFCNT_DEC;
 
     if (slab && slab->opslab_readonly) {
-        Slab_to_rw(o);
+        Slab_to_rw(slab);
         result = --o->op_targ;
         Slab_to_ro(slab);
     } else {
@@ -714,7 +709,8 @@ Perl_op_free(pTHX_ OP *o)
     if (type == OP_NULL)
        type = (OPCODE)o->op_targ;
 
-    Slab_to_rw(o);
+    if (o->op_slabbed)
+        Slab_to_rw(OpSLAB(o));
 
     /* COP* is not cleared by op_clear() so that we may track line
      * numbers etc even after null() */
diff --git a/proto.h b/proto.h
index 7670835..07cfd9a 100644 (file)
--- a/proto.h
+++ b/proto.h
@@ -5324,10 +5324,10 @@ PERL_CALLCONV PADOFFSET Perl_op_refcnt_dec(pTHX_ OP *o)
 
 PERL_CALLCONV OP *     Perl_op_refcnt_inc(pTHX_ OP *o);
 #  if defined(PERL_IN_OP_C)
-STATIC void    S_Slab_to_rw(pTHX_ void *op)
+STATIC void    S_Slab_to_rw(pTHX_ OPSLAB *const slab)
                        __attribute__nonnull__(pTHX_1);
 #define PERL_ARGS_ASSERT_SLAB_TO_RW    \
-       assert(op)
+       assert(slab)
 
 #  endif
 #endif