From 219f10596c17e38b2716673a140c2b3827549862 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 15 Sep 2014 17:27:58 -0700 Subject: [PATCH 09/10] grep: port -P speedup to hosts lacking PCRE_STUDY_JIT_COMPILE * src/pcresearch.c (Pcompile): Do not assume that PCRE_STUDY_JIT_COMPILE is defined. (empty_match): Define on all platforms. --- src/pcresearch.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/pcresearch.c b/src/pcresearch.c index 95877e3..ce65758 100644 --- a/src/pcresearch.c +++ b/src/pcresearch.c @@ -33,10 +33,6 @@ static pcre *cre; /* Additional information about the pattern. */ static pcre_extra *extra; -/* Table, indexed by ! (flag & PCRE_NOTBOL), of whether the empty - string matches when that flag is used. */ -static int empty_match[2]; - # ifdef PCRE_STUDY_JIT_COMPILE static pcre_jit_stack *jit_stack; # else @@ -44,6 +40,10 @@ static pcre_jit_stack *jit_stack; # endif #endif +/* Table, indexed by ! (flag & PCRE_NOTBOL), of whether the empty + string matches when that flag is used. */ +static int empty_match[2]; + void Pcompile (char const *pattern, size_t size) { @@ -129,11 +129,11 @@ Pcompile (char const *pattern, size_t size) pcre_assign_jit_stack (extra, NULL, jit_stack); } - empty_match[false] = pcre_exec (cre, extra, "", 0, 0, PCRE_NOTBOL, NULL, 0); - empty_match[true] = pcre_exec (cre, extra, "", 0, 0, 0, NULL, 0); - # endif free (re); + + empty_match[false] = pcre_exec (cre, extra, "", 0, 0, PCRE_NOTBOL, NULL, 0); + empty_match[true] = pcre_exec (cre, extra, "", 0, 0, 0, NULL, 0); #endif /* HAVE_LIBPCRE */ } -- 1.9.3