regcomp.c: Change debug output to use \t, etc instead of hex
authorKarl Williamson <public@khwilliamson.com>
Sun, 28 Jul 2013 00:19:29 +0000 (18:19 -0600)
committerKarl Williamson <public@khwilliamson.com>
Tue, 30 Jul 2013 18:05:47 +0000 (12:05 -0600)
It is easier to read the standard abbreviations \t, \n, etc than the hex
equivalents, \x09, ...

regcomp.c

index 4c0b8f2..8541cc6 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -15483,12 +15483,22 @@ S_put_byte(pTHX_ SV *sv, int c)
 
        So the old condition can be simplified to !isPRINT(c)  */
     if (!isPRINT(c)) {
+        switch (c) {
+            case '\r': Perl_sv_catpvf(aTHX_ sv, "\\r"); break;
+            case '\n': Perl_sv_catpvf(aTHX_ sv, "\\n"); break;
+            case '\t': Perl_sv_catpvf(aTHX_ sv, "\\t"); break;
+            case '\f': Perl_sv_catpvf(aTHX_ sv, "\\f"); break;
+            case '\a': Perl_sv_catpvf(aTHX_ sv, "\\a"); break;
+
+            default:
        if (c < 256) {
            Perl_sv_catpvf(aTHX_ sv, "\\x%02x", c);
        }
        else {
            Perl_sv_catpvf(aTHX_ sv, "\\x{%x}", c);
        }
+                break;
+        }
     }
     else {
        const char string = c;