Change 33060 by [EMAIL PROTECTED] on 2008/01/24 12:15:43

        Avoid using cx->blk_loop.itermax when reverse iterating an array.

Affected files ...

... //depot/perl/pp_ctl.c#670 edit
... //depot/perl/pp_hot.c#561 edit

Differences ...

==== //depot/perl/pp_ctl.c#670 (text) ====
Index: perl/pp_ctl.c
--- perl/pp_ctl.c#669~33059~    2008-01-24 02:44:25.000000000 -0800
+++ perl/pp_ctl.c       2008-01-24 04:15:43.000000000 -0800
@@ -1918,7 +1918,7 @@
            }
        }
        else if (PL_op->op_private & OPpITER_REVERSED) {
-           cx->blk_loop.itermax = 0;
+           cx->blk_loop.itermax = 0xDEADBEEF;
            cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary) + 1;
 
        }

==== //depot/perl/pp_hot.c#561 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#560~33059~    2008-01-24 02:44:25.000000000 -0800
+++ perl/pp_hot.c       2008-01-24 04:15:43.000000000 -0800
@@ -1976,7 +1976,8 @@
     /* iterate array */
     if (PL_op->op_private & OPpITER_REVERSED) {
        /* In reverse, use itermax as the min :-)  */
-       if (cx->blk_loop.iterix <= cx->blk_loop.itermax)
+       if (cx->blk_loop.iterix <= (CxTYPE(cx) == CXt_LOOP_STACK
+                                   ? cx->blk_loop.itermax : 0))
            RETPUSHNO;
 
        if (SvMAGICAL(av) || AvREIFY(av)) {
End of Patch.

Reply via email to