This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
utf8.c: foldEQ_utf8_flags() use specific flag, not just any
authorKarl Williamson <public@khwilliamson.com>
Sun, 18 Dec 2011 18:38:34 +0000 (11:38 -0700)
committerKarl Williamson <public@khwilliamson.com>
Sun, 18 Dec 2011 19:09:00 +0000 (12:09 -0700)
The test here was if any flag was set, not the particular desired one.
This doesn't cause any bugs as things are currently structured, but
could in the future.

The reason it doesn't cause any bugs currently are that the other
flags are tested first, and only if they are both 0 does this flag get
tested.

utf8.c

diff --git a/utf8.c b/utf8.c
index 7bc2b38..5444e3d 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -3960,7 +3960,7 @@ Perl_foldEQ_utf8_flags(pTHX_ const char *s1, char **pe1, register UV l1, bool u1
                    n1 = n2 = 0;
                }
                else if (isASCII(*p2)) {
-                   if (flags && ! isASCII(*p1)) {
+                   if ((flags & FOLDEQ_UTF8_NOMIX_ASCII) && ! isASCII(*p1)) {
                        return 0;
                    }
                    n2 = 1;