Merge branch 'ab/pcre-v2'
Update "perl-compatible regular expression" support to enable JIT and also allow linking with the newer PCRE v2 library. * ab/pcre-v2: grep: add support for PCRE v2 grep: un-break building with PCRE >= 8.32 without --enable-jit grep: un-break building with PCRE < 8.20 grep: un-break building with PCRE < 8.32 grep: add support for the PCRE v1 JIT API log: add -P as a synonym for --perl-regexp grep: skip pthreads overhead when using one thread grep: don't redundantly compile throwaway patterns under threading
This commit is contained in:
@ -224,7 +224,8 @@ static void start_threads(struct grep_opt *opt)
|
||||
int err;
|
||||
struct grep_opt *o = grep_opt_dup(opt);
|
||||
o->output = strbuf_out;
|
||||
o->debug = 0;
|
||||
if (i)
|
||||
o->debug = 0;
|
||||
compile_grep_patterns(o);
|
||||
err = pthread_create(&threads[i], NULL, run, o);
|
||||
|
||||
@ -1170,8 +1171,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
|
||||
if (!opt.fixed && opt.ignore_case)
|
||||
opt.regflags |= REG_ICASE;
|
||||
|
||||
compile_grep_patterns(&opt);
|
||||
|
||||
/*
|
||||
* We have to find "--" in a separate pass, because its presence
|
||||
* influences how we will parse arguments that come before it.
|
||||
@ -1244,12 +1243,23 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
|
||||
num_threads = GREP_NUM_THREADS_DEFAULT;
|
||||
else if (num_threads < 0)
|
||||
die(_("invalid number of threads specified (%d)"), num_threads);
|
||||
if (num_threads == 1)
|
||||
num_threads = 0;
|
||||
#else
|
||||
if (num_threads)
|
||||
warning(_("no threads support, ignoring --threads"));
|
||||
num_threads = 0;
|
||||
#endif
|
||||
|
||||
if (!num_threads)
|
||||
/*
|
||||
* The compiled patterns on the main path are only
|
||||
* used when not using threading. Otherwise
|
||||
* start_threads() below calls compile_grep_patterns()
|
||||
* for each thread.
|
||||
*/
|
||||
compile_grep_patterns(&opt);
|
||||
|
||||
#ifndef NO_PTHREADS
|
||||
if (num_threads) {
|
||||
if (!(opt.name_only || opt.unmatch_name_only || opt.count)
|
||||
|
Reference in New Issue
Block a user