aboutsummaryrefslogtreecommitdiff
path: root/grep.h
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-06-19 12:38:43 -0700
committerJunio C Hamano <gitster@pobox.com>2017-06-19 12:38:43 -0700
commitae7e4d4fedc2237217a9f802eba4ded9ea66bb91 (patch)
tree6a10111b07939e0013082185ad4d5d471822bf03 /grep.h
parent32e0da583f70fe1406268217befd61e3f515505f (diff)
parent94da9193a6eb8f1085d611c04ff8bbb4f5ae1e0a (diff)
downloadgit-ae7e4d4fedc2237217a9f802eba4ded9ea66bb91.tar.xz
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
Diffstat (limited to 'grep.h')
-rw-r--r--grep.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/grep.h b/grep.h
index 38ac82b638..6f3d4e1954 100644
--- a/grep.h
+++ b/grep.h
@@ -3,9 +3,33 @@
#include "color.h"
#ifdef USE_LIBPCRE1
#include <pcre.h>
+#ifdef PCRE_CONFIG_JIT
+#if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32
+#ifndef NO_LIBPCRE1_JIT
+#define GIT_PCRE1_USE_JIT
+#endif
+#endif
+#endif
+#ifndef PCRE_STUDY_JIT_COMPILE
+#define PCRE_STUDY_JIT_COMPILE 0
+#endif
+#if PCRE_MAJOR <= 8 && PCRE_MINOR < 20
+typedef int pcre_jit_stack;
+#endif
#else
typedef int pcre;
typedef int pcre_extra;
+typedef int pcre_jit_stack;
+#endif
+#ifdef USE_LIBPCRE2
+#define PCRE2_CODE_UNIT_WIDTH 8
+#include <pcre2.h>
+#else
+typedef int pcre2_code;
+typedef int pcre2_match_data;
+typedef int pcre2_compile_context;
+typedef int pcre2_match_context;
+typedef int pcre2_jit_stack;
#endif
#include "kwset.h"
#include "thread-utils.h"
@@ -48,7 +72,15 @@ struct grep_pat {
regex_t regexp;
pcre *pcre1_regexp;
pcre_extra *pcre1_extra_info;
+ pcre_jit_stack *pcre1_jit_stack;
const unsigned char *pcre1_tables;
+ int pcre1_jit_on;
+ pcre2_code *pcre2_pattern;
+ pcre2_match_data *pcre2_match_data;
+ pcre2_compile_context *pcre2_compile_context;
+ pcre2_match_context *pcre2_match_context;
+ pcre2_jit_stack *pcre2_jit_stack;
+ uint32_t pcre2_jit_on;
kwset_t kws;
unsigned fixed:1;
unsigned ignore_case:1;
@@ -112,6 +144,7 @@ struct grep_opt {
int extended;
int use_reflog_filter;
int pcre1;
+ int pcre2;
int relative;
int pathname;
int null_following_name;