This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: put_byte wants an ord, not a utf8 char
authorKarl Williamson <public@khwilliamson.com>
Thu, 5 Jan 2012 18:44:48 +0000 (11:44 -0700)
committerKarl Williamson <public@khwilliamson.com>
Fri, 13 Jan 2012 16:58:37 +0000 (09:58 -0700)
These were calling put_byte() incorrectly, with a utf8 char instead of a
the ordinal.

regcomp.c

index efa446f..a907b7d 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -11944,20 +11944,12 @@ Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o)
                        } else if (rangestart != -1) {
                            if (i <= rangestart + 3)
                                for (; rangestart < i; rangestart++) {
-                                   const U8 * const e = uvchr_to_utf8(s,rangestart);
-                                   U8 *p;
-                                   for(p = s; p < e; p++)
-                                       put_byte(sv, *p);
+                                   put_byte(sv, rangestart);
                                }
                            else {
-                               const U8 *e = uvchr_to_utf8(s,rangestart);
-                               U8 *p;
-                               for (p = s; p < e; p++)
-                                   put_byte(sv, *p);
+                               put_byte(sv, rangestart);
                                sv_catpvs(sv, "-");
-                               e = uvchr_to_utf8(s, i-1);
-                               for (p = s; p < e; p++)
-                                   put_byte(sv, *p);
+                               put_byte(sv, i-1);
                            }
                            rangestart = -1;
                        }