diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
commit | 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch) | |
tree | 85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/grep.h | |
parent | 6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff) |
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/grep.h')
-rw-r--r-- | third_party/git/grep.h | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/third_party/git/grep.h b/third_party/git/grep.h index 9115db851505..1875880f3799 100644 --- a/third_party/git/grep.h +++ b/third_party/git/grep.h @@ -3,12 +3,24 @@ #include "color.h" #ifdef USE_LIBPCRE1 #include <pcre.h> -#ifndef PCRE_NO_UTF8_CHECK -#define PCRE_NO_UTF8_CHECK 0 +#ifdef PCRE_CONFIG_JIT +#if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32 +#ifndef NO_LIBPCRE1_JIT +#define GIT_PCRE1_USE_JIT +#define GIT_PCRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE +#endif +#endif +#endif +#ifndef GIT_PCRE_STUDY_JIT_COMPILE +#define GIT_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 @@ -17,7 +29,10 @@ typedef int pcre_extra; 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" @@ -73,15 +88,17 @@ 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; - const uint8_t *pcre2_tables; + pcre2_match_context *pcre2_match_context; + pcre2_jit_stack *pcre2_jit_stack; uint32_t pcre2_jit_on; + kwset_t kws; unsigned fixed:1; - unsigned is_fixed:1; unsigned ignore_case:1; unsigned word_regexp:1; }; @@ -156,7 +173,6 @@ struct grep_opt { int funcbody; int extended_regexp_option; int pattern_type_option; - int ignore_locale; char colors[NR_GREP_COLORS][COLOR_MAXLEN]; unsigned pre_context; unsigned post_context; @@ -173,7 +189,6 @@ struct grep_opt { void init_grep_defaults(struct repository *); int grep_config(const char *var, const char *value, void *); void grep_init(struct grep_opt *, struct repository *repo, const char *prefix); -void grep_destroy(void); void grep_commit_pattern_type(enum grep_pattern_type, struct grep_opt *opt); void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t); @@ -220,5 +235,18 @@ int grep_threads_ok(const struct grep_opt *opt); */ extern int grep_use_locks; extern pthread_mutex_t grep_attr_mutex; +extern pthread_mutex_t grep_read_mutex; + +static inline void grep_read_lock(void) +{ + if (grep_use_locks) + pthread_mutex_lock(&grep_read_mutex); +} + +static inline void grep_read_unlock(void) +{ + if (grep_use_locks) + pthread_mutex_unlock(&grep_read_mutex); +} #endif |