This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
regcomp.c: Simplify expression
authorKarl Williamson <khw@cpan.org>
Thu, 2 Mar 2017 04:52:22 +0000 (21:52 -0700)
committerKarl Williamson <khw@cpan.org>
Thu, 1 Jun 2017 14:30:24 +0000 (08:30 -0600)
Here, there is no advantage to assigning a variable within an 'if', and
it is somewhat harder to read, so don't do it.

regcomp.c

index 6fc3716..97c5949 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -12017,7 +12017,8 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
 
     RExC_parse++;      /* Skip past the '{' */
 
-    if (! (endbrace = strchr(RExC_parse, '}'))) { /* no trailing brace */
+    endbrace = strchr(RExC_parse, '}');
+    if (! endbrace) { /* no trailing brace */
         vFAIL2("Missing right brace on \\%c{}", 'N');
     }
     else if(!(endbrace == RExC_parse           /* nothing between the {} */