read-cache: fix index corruption with index v4
[gitweb.git] / grep.h
diff --git a/grep.h b/grep.h
index ce909697361125c28aa9ecbb401735d9ad47397d..0c091e5104a83c0f83c65fd0bef9f39caf8f644d 100644 (file)
--- a/grep.h
+++ b/grep.h
@@ -5,9 +5,11 @@
 #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
@@ -19,6 +21,16 @@ 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"
 #include "userdiff.h"
@@ -63,6 +75,12 @@ struct grep_pat {
        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;
@@ -126,6 +144,7 @@ struct grep_opt {
        int extended;
        int use_reflog_filter;
        int pcre1;
+       int pcre2;
        int relative;
        int pathname;
        int null_following_name;
@@ -143,7 +162,6 @@ struct grep_opt {
        char color_match_selected[COLOR_MAXLEN];
        char color_selected[COLOR_MAXLEN];
        char color_sep[COLOR_MAXLEN];
-       int regflags;
        unsigned pre_context;
        unsigned post_context;
        unsigned last_shown;
@@ -172,7 +190,7 @@ struct grep_source {
        char *name;
 
        enum grep_source_type {
-               GREP_SOURCE_SHA1,
+               GREP_SOURCE_OID,
                GREP_SOURCE_FILE,
                GREP_SOURCE_BUF,
                GREP_SOURCE_SUBMODULE,