summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-09-15 17:27:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-09-16 18:23:50 -0700
commitaf3572e2651379566441c9d718dec7e809d3810d (patch)
treed58fed4358a9a241746874b10c87e8f66f46b8b5
parenta19e4898d4fa7808fbccb0c9b0ab2cd77e3abcbe (diff)
downloadgrep-af3572e2651379566441c9d718dec7e809d3810d.tar.gz
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.
-rw-r--r--src/pcresearch.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pcresearch.c b/src/pcresearch.c
index 95877e37..ce65758c 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 */
}