Re: [perl #17830] open FH, "<&", $fd
[p5sagit/p5-mst-13.2.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index c2818c8..a5e92cb 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -237,9 +237,17 @@ Perl_is_utf8_string(pTHX_ U8 *s, STRLEN len)
     send = s + len;
 
     while (x < send) {
-        c = is_utf8_char(x);
-       if (!c)
-           return FALSE;
+        /* Inline the easy bits of is_utf8_char() here for speed... */
+        if (UTF8_IS_INVARIANT(*x))
+             c = 1;
+        else if (!UTF8_IS_START(*x))
+             return FALSE;
+        else {
+             /* ... and call is_utf8_char() only if really needed. */
+             c = is_utf8_char(x);
+             if (!c)
+                  return FALSE;
+        }
         x += c;
     }
     if (x != send)
@@ -1534,6 +1542,7 @@ Perl_swash_init(pTHX_ char* pkg, char* name, SV *listsv, I32 minbits, I32 none)
     if (PL_curcop == &PL_compiling) {
        /* XXX ought to be handled by lex_start */
        SAVEI32(PL_in_my);
+       PL_in_my = 0;
        sv_setpv(tokenbufsv, PL_tokenbuf);
     }
     errsv_save = newSVsv(ERRSV);