This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fix a signed/unsigned comparison warning
[perl5.git] / regexec.c
index d84190b..d3e9c25 100644 (file)
--- a/regexec.c
+++ b/regexec.c
@@ -5004,7 +5004,34 @@ NULL
             sayNO;
             /* NOTREACHED */
 #undef ST
-
+        case FOLDCHAR:
+            n = ARG(scan);
+           if (nextchr == (I32)n) {
+                locinput += UTF8SKIP(locinput);
+            } else {
+                /* This malarky is to handle LATIN SMALL LETTER SHARP S 
+                   properly. Sigh */
+                if (0xDF==n && (UTF||do_utf8) &&  
+                    toLOWER(locinput[0])=='s' && toLOWER(locinput[1])=='s') 
+                {
+                    locinput += 2;
+                } else if (do_utf8) {
+                    U8 tmpbuf1[UTF8_MAXBYTES_CASE+1];
+                    STRLEN tmplen1;
+                    U8 tmpbuf2[UTF8_MAXBYTES_CASE+1];
+                    STRLEN tmplen2;
+                    to_uni_fold(n, tmpbuf1, &tmplen1);
+                    to_utf8_fold((U8*)locinput, tmpbuf2, &tmplen2);    
+                    if (tmplen1!=tmplen2
+                       || !strnEQ((char *)tmpbuf1,(char *)tmpbuf2,tmplen1))
+                        sayNO;
+                    else 
+                        locinput += UTF8SKIP(locinput);
+                } else 
+                    sayNO;
+            } 
+            nextchr = UCHARAT(locinput);  
+            break;
         case LNBREAK:
             if ((n=is_LNBREAK(locinput,do_utf8))) {
                 locinput += n;