Fix regexec.c so $^N and $+ are correctly updated so that they work properly inside...
[p5sagit/p5-mst-13.2.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index e9e14fc..440ee76 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -536,7 +536,7 @@ malformed:
     }
 
     if (dowarn) {
-       SV* const sv = sv_2mortal(newSVpvs("Malformed UTF-8 character "));
+       SV* const sv = newSVpvs_flags("Malformed UTF-8 character ", SVs_TEMP);
 
        switch (warning) {
        case 0: /* Intentionally empty. */ break;
@@ -1587,11 +1587,11 @@ Perl_swash_init(pTHX_ const char* pkg, const char* name, SV *listsv, I32 minbits
     SPAGAIN;
     PUSHMARK(SP);
     EXTEND(SP,5);
-    PUSHs(sv_2mortal(newSVpvn(pkg, pkg_len)));
-    PUSHs(sv_2mortal(newSVpvn(name, name_len)));
+    mPUSHp(pkg, pkg_len);
+    mPUSHp(name, name_len);
     PUSHs(listsv);
-    PUSHs(sv_2mortal(newSViv(minbits)));
-    PUSHs(sv_2mortal(newSViv(none)));
+    mPUSHi(minbits);
+    mPUSHi(none);
     PUTBACK;
     errsv_save = newSVsv(ERRSV);
     if (call_method("SWASHNEW", G_SCALAR))
@@ -2168,13 +2168,13 @@ Perl_pv_uni_display(pTHX_ SV *dsv, const U8 *spv, STRLEN len, STRLEN pvlim, UV f
                 default: break;
                 }
                 if (ok) {
-                    const unsigned char string = (unsigned char) ok;
+                    const char string = ok;
                     sv_catpvn(dsv, &string, 1);
                 }
             }
             /* isPRINT() is the locale-blind version. */
             if (!ok && (flags & UNI_DISPLAY_ISPRINT) && isPRINT(c)) {
-                const unsigned char string = (unsigned char) c;
+                const char string = c;
                 sv_catpvn(dsv, &string, 1);
                 ok = 1;
             }
@@ -2254,13 +2254,18 @@ Perl_ibcmp_utf8(pTHX_ const char *s1, char **pe1, register UV l1, bool u1, const
      
      if (pe1)
          e1 = *(U8**)pe1;
+     /* assert(e1 || l1); */
      if (e1 == 0 || (l1 && l1 < (UV)(e1 - (const U8*)s1)))
          f1 = (const U8*)s1 + l1;
      if (pe2)
          e2 = *(U8**)pe2;
+     /* assert(e2 || l2); */
      if (e2 == 0 || (l2 && l2 < (UV)(e2 - (const U8*)s2)))
          f2 = (const U8*)s2 + l2;
 
+     /* This shouldn't happen. However, putting an assert() there makes some
+      * tests fail. */
+     /* assert((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0)); */
      if ((e1 == 0 && f1 == 0) || (e2 == 0 && f2 == 0) || (f1 == 0 && f2 == 0))
          return 1; /* mismatch; possible infinite loop or false positive */