Move the declaration of two variables into the only block that uses
[p5sagit/p5-mst-13.2.git] / regexec.c
index 3d64f20..e382a2a 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -1663,8 +1663,8 @@ S_swap_match_buff (pTHX_ regexp *prog) {
     */
         Newxz(prog->swap, 1, regexp_paren_ofs);
         /* no need to copy these */
-        Newxz(prog->swap->startp, prog->nparens + 1, I32);
-        Newxz(prog->swap->endp, prog->nparens + 1, I32);
+        Newxz(prog->swap->startp, 2 * (prog->nparens + 1), I32);
+       prog->swap->endp = prog->swap->startp + prog->nparens + 1;
     }
     t = prog->swap->startp;
     prog->swap->startp = prog->startp;
@@ -2148,8 +2148,6 @@ STATIC I32                        /* 0 failure, 1 success */
 S_regtry(pTHX_ regmatch_info *reginfo, char **startpos)
 {
     dVAR;
-    register I32 *sp;
-    register I32 *ep;
     CHECKPOINT lastcp;
     regexp *prog = reginfo->prog;
     RXi_GET_DECL(prog,progi);
@@ -2259,9 +2257,9 @@ S_regtry(pTHX_ regmatch_info *reginfo, char **startpos)
      * on those tests seems to be returning null fields from matches.
      * --jhi */
 #if 1
-    sp = PL_regstartp;
-    ep = PL_regendp;
     if (prog->nparens) {
+       I32 *sp = PL_regstartp;
+       I32 *ep = PL_regendp;
        register I32 i;
        for (i = prog->nparens; i > (I32)*PL_reglastparen; i--) {
            *++sp = -1;