This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: in debug output, don't duplicate code points
authorKarl Williamson <public@khwilliamson.com>
Thu, 5 Jan 2012 20:21:57 +0000 (13:21 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:37 +0000 (09:58 -0700)
The non-bitmap portion of an ANYOF node may also be in the bitmap
portion.  There is no sense in having duplicate output

regcomp.c

index 6904be8..0c30210 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11938,7 +11938,13 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                    for (i = 0; i <= 256; i++) { /* Look at chars in bitmap */
                        uvchr_to_utf8(s, i);
 
                    for (i = 0; i <= 256; i++) { /* Look at chars in bitmap */
                        uvchr_to_utf8(s, i);
 
-                       if (i < 256 && swash_fetch(sw, s, TRUE)) {
+                       if (i < 256
+                            && ! ANYOF_BITMAP_TEST(o, i)    /* Don't duplicate
+                                                               things already
+                                                               output as part
+                                                               of the bitmap */
+                            && swash_fetch(sw, s, TRUE))
+                        {
                            if (rangestart == -1)
                                rangestart = i;
                        } else if (rangestart != -1) {
                            if (rangestart == -1)
                                rangestart = i;
                        } else if (rangestart != -1) {