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 19:14:38 +0000 (12:14 -0700)
committerKarl Williamson <khw@cpan.org>
Tue, 20 Feb 2018 08:37:23 +0000 (01:37 -0700)
The previous commit has made part of this 'if' redundant, so the whole
thing can be simplified.

regcomp.c

index a5feddf..3c57ee7 100644 (file)
--- a/regcomp.c
+++ b/regcomp.c
@@ -12386,10 +12386,9 @@ S_grok_bslash_N(pTHX_ RExC_state_t *pRExC_state,
         return TRUE;
     }
 
-    if (!(endbrace == RExC_parse               /* nothing between the {} */
-              || (endbrace - RExC_parse >= 2   /* U+ (bad hex is checked... */
-                  && strnEQ(RExC_parse, "U+", 2)))) /* ... below for a better
-                                                       error msg) */
+    /* If we haven't got something that begins with 'U+', then it didn't get lexed. */
+    if (   endbrace - RExC_parse < 2
+        || strnNE(RExC_parse, "U+", 2))
     {
        RExC_parse = endbrace;  /* position msg's '<--HERE' */
        vFAIL("\\N{NAME} must be resolved by the lexer");