This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Swap if/else clauses
authorKarl Williamson <khw@cpan.org>
Tue, 26 Aug 2014 14:36:31 +0000 (08:36 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 3 Sep 2014 18:43:15 +0000 (12:43 -0600)
This makes it slightly easier to understand as there is no explicit
complement, but is mostly for a future commit.

regcomp.c

index 648042a..12d3a3d 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -16697,7 +16697,13 @@ S_put_byte(pTHX_ SV *sv, int c)
 {
     PERL_ARGS_ASSERT_PUT_BYTE;
 
-    if (!isPRINT(c)) {
+    if (isPRINT(c)) {
+       const char string = c;
+       if (isBACKSLASHED_PUNCT(c))
+           sv_catpvs(sv, "\\");
+       sv_catpvn(sv, &string, 1);
+    }
+    else {
         switch (c) {
             case '\a': Perl_sv_catpvf(aTHX_ sv, "\\a"); break;
             case '\b': Perl_sv_catpvf(aTHX_ sv, "\\b"); break;
@@ -16709,12 +16715,6 @@ S_put_byte(pTHX_ SV *sv, int c)
             default: Perl_sv_catpvf(aTHX_ sv, "\\x{%02X}", c); break;
         }
     }
-    else {
-       const char string = c;
-       if (isBACKSLASHED_PUNCT(c))
-           sv_catpvs(sv, "\\");
-       sv_catpvn(sv, &string, 1);
-    }
 }
 
 #define MAX_PRINT_A MAX_PRINT_A_FOR_USE_ONLY_BY_REGCOMP_DOT_C