X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=grep.h;h=811fd274c95b0528223fff8d684c5299c10a9967;hb=341f8a6476d1d25c3906696489d87fc381739b59;hp=0ba62a11c5cc2767b15b52aca20a0ea5b00870b8;hpb=7c9fbda6e2e0ac4a491863253aeedeafb3cb9dab;p=thirdparty%2Fgit.git diff --git a/grep.h b/grep.h index 0ba62a11c5..811fd274c9 100644 --- a/grep.h +++ b/grep.h @@ -3,24 +3,12 @@ #include "color.h" #ifdef USE_LIBPCRE1 #include -#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; +#ifndef PCRE_NO_UTF8_CHECK +#define PCRE_NO_UTF8_CHECK 0 #endif #else typedef int pcre; typedef int pcre_extra; -typedef int pcre_jit_stack; #endif #ifdef USE_LIBPCRE2 #define PCRE2_CODE_UNIT_WIDTH 8 @@ -29,13 +17,12 @@ typedef int pcre_jit_stack; 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" +struct repository; + enum grep_pat_token { GREP_PATTERN, GREP_PATTERN_HEAD, @@ -86,17 +73,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; + const uint8_t *pcre2_tables; uint32_t pcre2_jit_on; - kwset_t kws; unsigned fixed:1; + unsigned is_fixed:1; unsigned ignore_case:1; unsigned word_regexp:1; }; @@ -136,6 +121,7 @@ struct grep_opt { struct grep_pat *header_list; struct grep_pat **header_tail; struct grep_expr *pattern_expression; + struct repository *repo; const char *prefix; int prefix_length; regex_t regexp; @@ -170,6 +156,7 @@ 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; @@ -183,17 +170,18 @@ struct grep_opt { void *output_priv; }; -extern void init_grep_defaults(void); -extern int grep_config(const char *var, const char *value, void *); -extern void grep_init(struct grep_opt *, const char *prefix); +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); -extern void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t); -extern void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t); -extern void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *); -extern void compile_grep_patterns(struct grep_opt *opt); -extern void free_grep_patterns(struct grep_opt *opt); -extern int grep_buffer(struct grep_opt *opt, char *buf, unsigned long size); +void append_grep_pat(struct grep_opt *opt, const char *pat, size_t patlen, const char *origin, int no, enum grep_pat_token t); +void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t); +void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *); +void compile_grep_patterns(struct grep_opt *opt); +void free_grep_patterns(struct grep_opt *opt); +int grep_buffer(struct grep_opt *opt, char *buf, unsigned long size); struct grep_source { char *name; @@ -217,15 +205,15 @@ void grep_source_init(struct grep_source *gs, enum grep_source_type type, const void *identifier); void grep_source_clear_data(struct grep_source *gs); void grep_source_clear(struct grep_source *gs); -void grep_source_load_driver(struct grep_source *gs); +void grep_source_load_driver(struct grep_source *gs, + struct index_state *istate); int grep_source(struct grep_opt *opt, struct grep_source *gs); -extern struct grep_opt *grep_opt_dup(const struct grep_opt *opt); -extern int grep_threads_ok(const struct grep_opt *opt); +struct grep_opt *grep_opt_dup(const struct grep_opt *opt); +int grep_threads_ok(const struct grep_opt *opt); -#ifndef NO_PTHREADS /* * Mutex used around access to the attributes machinery if * opt->use_threads. Must be initialized/destroyed by callers! @@ -246,9 +234,4 @@ static inline void grep_read_unlock(void) pthread_mutex_unlock(&grep_read_mutex); } -#else -#define grep_read_lock() -#define grep_read_unlock() -#endif - #endif