From d4405284bef0786f068653135984f30606cae144 Mon Sep 17 00:00:00 2001 From: Karl Williamson Date: Wed, 18 Dec 2013 22:53:46 -0700 Subject: [PATCH] regcomp.c: Refactor 'if' statement This refactoring makes it clear that within a (?[]), we don't try to optimize the [] part. This is for clarity for the future only, as currently the only changed behavior is if this is being compiled with /l rules, and (?[]) generates a syntax error under /l. --- regcomp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/regcomp.c b/regcomp.c index 5c3260a..5b10edd 100644 --- a/regcomp.c +++ b/regcomp.c @@ -13953,8 +13953,9 @@ parseit: /* If the character class contains only a single element, it may be * optimizable into another node type which is smaller and runs faster. * Check if this is the case for this class */ - if ((element_count == 1 && ! ret_invlist) - || UNLIKELY(posixl_matches_all)) + if (! ret_invlist /* Can't optimize if returning the constructed + inversion list */ + && (UNLIKELY(posixl_matches_all) || element_count == 1)) { U8 op = END; U8 arg = 0; -- 2.7.4