This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Put PL_cop_seqmax++ code in one spot
authorFather Chrysostomos <sprout@cpan.org>
Sat, 15 Nov 2014 18:09:24 +0000 (10:09 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 15 Nov 2014 18:59:13 +0000 (10:59 -0800)
op.c
pad.c
pad.h

diff --git a/op.c b/op.c
index 8a0c7fa..98d6ff3 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3706,9 +3706,8 @@ Perl_block_start(pTHX_ int full)
 {
     const int retval = PL_savestack_ix;
 
 {
     const int retval = PL_savestack_ix;
 
-    PL_compiling.cop_seq = PL_cop_seqmax++;
-    if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */
-       PL_cop_seqmax++;
+    PL_compiling.cop_seq = PL_cop_seqmax;
+    COP_SEQMAX_INC;
     pad_block_start(full);
     SAVEHINTS();
     PL_hints &= ~HINT_BLOCK_SCOPE;
     pad_block_start(full);
     SAVEHINTS();
     PL_hints &= ~HINT_BLOCK_SCOPE;
@@ -5889,10 +5888,7 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *idop, OP *arg)
 
     PL_hints |= HINT_BLOCK_SCOPE;
     PL_parser->copline = NOLINE;
 
     PL_hints |= HINT_BLOCK_SCOPE;
     PL_parser->copline = NOLINE;
-    PL_cop_seqmax++; /* Purely for B::*'s benefit */
-    if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */
-       PL_cop_seqmax++;
-
+    COP_SEQMAX_INC; /* Purely for B::*'s benefit */
 }
 
 /*
 }
 
 /*
diff --git a/pad.c b/pad.c
index 0775a42..1533ec5 100644 (file)
--- a/pad.c
+++ b/pad.c
@@ -1571,9 +1571,7 @@ Perl_intro_my(pTHX)
            );
        }
     }
            );
        }
     }
-    PL_cop_seqmax++;
-    if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */
-       PL_cop_seqmax++;
+    COP_SEQMAX_INC;
     PL_min_intro_pending = 0;
     PL_comppad_name_fill = PL_max_intro_pending; /* Needn't search higher */
     DEBUG_Xv(PerlIO_printf(Perl_debug_log,
     PL_min_intro_pending = 0;
     PL_comppad_name_fill = PL_max_intro_pending; /* Needn't search higher */
     DEBUG_Xv(PerlIO_printf(Perl_debug_log,
@@ -1631,9 +1629,7 @@ Perl_pad_leavemy(pTHX)
            }
        }
     }
            }
        }
     }
-    PL_cop_seqmax++;
-    if (PL_cop_seqmax == PERL_PADSEQ_INTRO) /* not a legal value */
-       PL_cop_seqmax++;
+    COP_SEQMAX_INC;
     DEBUG_Xv(PerlIO_printf(Perl_debug_log,
            "Pad leavemy: seq = %ld\n", (long)PL_cop_seqmax));
     return o;
     DEBUG_Xv(PerlIO_printf(Perl_debug_log,
            "Pad leavemy: seq = %ld\n", (long)PL_cop_seqmax));
     return o;
diff --git a/pad.h b/pad.h
index 3ca79d3..0e29b10 100644 (file)
--- a/pad.h
+++ b/pad.h
@@ -39,6 +39,9 @@ struct padlist {
  * flagging that a lexical is being introduced, or has not yet left scope
  */
 #define PERL_PADSEQ_INTRO  U32_MAX
  * flagging that a lexical is being introduced, or has not yet left scope
  */
 #define PERL_PADSEQ_INTRO  U32_MAX
+#define COP_SEQMAX_INC \
+       (PL_cop_seqmax++, \
+        (void)(PL_cop_seqmax == PERL_PADSEQ_INTRO && PL_cop_seqmax++))
 
 
 /* B.xs needs these for the benefit of B::Deparse */
 
 
 /* B.xs needs these for the benefit of B::Deparse */