Update Changes.
[p5sagit/p5-mst-13.2.git] / regcomp.c
index d2195b0..723cbbe 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -220,9 +220,9 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  * arg. Show regex, up to a maximum length. If it's too long, chop and add
  * "...".
  */
-#define        FAIL(m)                                                              \
+#define        FAIL(msg)                                                             \
     STMT_START {                                                             \
-        char *elipises = "";                                                 \
+        char *ellipses = "";                                                 \
         unsigned len = strlen(PL_regprecomp);                                \
                                                                              \
        if (!SIZE_ONLY)                                                      \
@@ -231,10 +231,10 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        if (len > RegexLengthToShowInErrorMessages) {                        \
             /* chop 10 shorter than the max, to ensure meaning of "..." */   \
            len = RegexLengthToShowInErrorMessages - 10;                     \
-           elipises = "...";                                                \
+           ellipses = "...";                                                \
        }                                                                    \
        Perl_croak(aTHX_ "%s in regex m/%.*s%s/",                            \
-                  m, len, PL_regprecomp, elipises);                         \
+                  msg, len, PL_regprecomp, ellipses);                        \
     } STMT_END
 
 /*
@@ -242,9 +242,9 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  * args. Show regex, up to a maximum length. If it's too long, chop and add
  * "...".
  */
-#define        FAIL2(pat,m)                                                         \
+#define        FAIL2(pat,msg)                                                        \
     STMT_START {                                                             \
-        char *elipises = "";                                                 \
+        char *ellipses = "";                                                 \
         unsigned len = strlen(PL_regprecomp);                                \
                                                                              \
        if (!SIZE_ONLY)                                                      \
@@ -253,10 +253,10 @@ static scan_data_t zero_scan_data = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        if (len > RegexLengthToShowInErrorMessages) {                        \
             /* chop 10 shorter than the max, to ensure meaning of "..." */   \
            len = RegexLengthToShowInErrorMessages - 10;                     \
-           elipises = "...";                                                \
+           ellipses = "...";                                                \
        }                                                                    \
        S_re_croak2(aTHX_ pat, " in regex m/%.*s%s/",                        \
-                   m, len, PL_regprecomp, elipises);                        \
+                   msg, len, PL_regprecomp, ellipses);                     \
     } STMT_END
 
 
@@ -2468,9 +2468,9 @@ tryagain:
            ret = reg_node(BOL);
        break;
     case '$':
-       if (PL_regcomp_parse[1]) 
-           PL_seen_zerolen++;
        nextchar();
+       if (*PL_regcomp_parse) 
+           PL_seen_zerolen++;
        if (PL_regflags & PMf_MULTILINE)
            ret = reg_node(MEOL);
        else if (PL_regflags & PMf_SINGLELINE)
@@ -4372,8 +4372,13 @@ Perl_pregfree(pTHX_ struct regexp *r)
                    Perl_croak(aTHX_ "panic: pregfree comppad");
                old_comppad = PL_comppad;
                old_curpad = PL_curpad;
-               PL_comppad = new_comppad;
-               PL_curpad = AvARRAY(new_comppad);
+               /* Watch out for global destruction's random ordering. */
+               if (SvTYPE(new_comppad) == SVt_PVAV) {
+                   PL_comppad = new_comppad;
+                   PL_curpad = AvARRAY(new_comppad);
+               }
+               else
+                   PL_curpad = NULL;
                op_free((OP_4tree*)r->data->data[n]);
                PL_comppad = old_comppad;
                PL_curpad = old_curpad;