Fix typo in description.
[p5sagit/p5-mst-13.2.git] / pp_ctl.c
index 71afbda..45ca9ea 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -726,7 +726,7 @@ PP(pp_formline)
            {
                const char *s = chophere;
                if (chopspace) {
-                   while (*s && isSPACE(*s))
+                   while (isSPACE(*s))
                        s++;
                }
                sv_chop(sv,s);
@@ -864,7 +864,7 @@ PP(pp_formline)
                const char *s = chophere;
                const char *send = item + len;
                if (chopspace) {
-                   while (*s && isSPACE(*s) && s < send)
+                   while (isSPACE(*s) && (s < send))
                        s++;
                }
                if (s < send) {
@@ -1802,8 +1802,8 @@ PP(pp_enteriter)
            }
        }
        else if (PL_op->op_private & OPpITER_REVERSED) {
-           cx->blk_loop.itermax = -1;
-           cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary);
+           cx->blk_loop.itermax = 0;
+           cx->blk_loop.iterix = AvFILL(cx->blk_loop.iterary) + 1;
 
        }
     }
@@ -1811,8 +1811,8 @@ PP(pp_enteriter)
        cx->blk_loop.iterary = PL_curstack;
        AvFILLp(PL_curstack) = SP - PL_stack_base;
        if (PL_op->op_private & OPpITER_REVERSED) {
-           cx->blk_loop.itermax = MARK - PL_stack_base;
-           cx->blk_loop.iterix = cx->blk_oldsp;
+           cx->blk_loop.itermax = MARK - PL_stack_base + 1;
+           cx->blk_loop.iterix = cx->blk_oldsp + 1;
        }
        else {
            cx->blk_loop.iterix = MARK - PL_stack_base;
@@ -2746,9 +2746,11 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
                       code, (unsigned long)++PL_evalseq,
                       CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
        tmpbuf = SvPVX(sv);
+       len = SvCUR(sv);
     }
     else
-       sprintf(tmpbuf, "_<(%.10s_eval %lu)", code, (unsigned long)++PL_evalseq);
+       len = my_sprintf(tmpbuf, "_<(%.10s_eval %lu)", code,
+                        (unsigned long)++PL_evalseq);
     SAVECOPFILE_FREE(&PL_compiling);
     CopFILE_set(&PL_compiling, tmpbuf+2);
     SAVECOPLINE(&PL_compiling);
@@ -2758,7 +2760,6 @@ Perl_sv_compile_2op(pTHX_ SV *sv, OP** startop, const char *code, PAD** padp)
        (i.e. before run-time proper). To work around the coredump that
        ensues, we always turn GvMULTI_on for any globals that were
        introduced within evals. See force_ident(). GSAR 96-10-12 */
-    len = strlen(tmpbuf);
     safestr = savepvn(tmpbuf, len);
     SAVEDELETE(PL_defstash, safestr, len);
     SAVEHINTS();
@@ -3313,10 +3314,8 @@ PP(pp_require)
     else
        SETERRNO(0, SS_NORMAL);
 
-    /* FIXME - is name ever assigned to after the SvPVX_const that also set
-       len?  If no, then this strlen() is superfluous.  */
     /* Assume success here to prevent recursive requirement. */
-    len = strlen(name);
+    /* name is never assigned to again, so len is still strlen(name)  */
     /* Check whether a hook in @INC has already filled %INC */
     if (!hook_sv) {
        (void)hv_store(GvHVn(PL_incgv), name, len, newSVpv(CopFILE(&PL_compiling),0),0);
@@ -3408,9 +3407,10 @@ PP(pp_entereval)
                       (unsigned long)++PL_evalseq,
                       CopFILE(PL_curcop), (IV)CopLINE(PL_curcop));
        tmpbuf = SvPVX(sv);
+       len = SvCUR(sv);
     }
     else
-       sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++PL_evalseq);
+       len = my_sprintf(tmpbuf, "_<(eval %lu)", (unsigned long)++PL_evalseq);
     SAVECOPFILE_FREE(&PL_compiling);
     CopFILE_set(&PL_compiling, tmpbuf+2);
     SAVECOPLINE(&PL_compiling);
@@ -3420,7 +3420,6 @@ PP(pp_entereval)
        (i.e. before run-time proper). To work around the coredump that
        ensues, we always turn GvMULTI_on for any globals that were
        introduced within evals. See force_ident(). GSAR 96-10-12 */
-    len = strlen(tmpbuf);
     safestr = savepvn(tmpbuf, len);
     SAVEDELETE(PL_defstash, safestr, len);
     SAVEHINTS();