grep: fix NO_LIBPCRE1_JIT to fully disable JIT
If you have a pcre1 library which is compiled with JIT enabled then PCRE_STUDY_JIT_COMPILE will be defined whether or not the NO_LIBPCRE1_JIT configuration is set. This means that we enable JIT functionality when calling pcre_study even if NO_LIBPCRE1_JIT has been explicitly set and we just use plain pcre_exec later. Fix this by using own macro (GIT_PCRE_STUDY_JIT_COMPILE) which we set to PCRE_STUDY_JIT_COMPILE only if NO_LIBPCRE1_JIT is not set and define to 0 otherwise, as before. Reviewed-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
							parent
							
								
									674ad936bb
								
							
						
					
					
						commit
						2fff1e196d
					
				
							
								
								
									
										2
									
								
								grep.c
								
								
								
								
							
							
						
						
									
										2
									
								
								grep.c
								
								
								
								
							|  | @ -380,7 +380,7 @@ static void compile_pcre1_regexp(struct grep_pat *p, const struct grep_opt *opt) | ||||||
| 	if (!p->pcre1_regexp) | 	if (!p->pcre1_regexp) | ||||||
| 		compile_regexp_failed(p, error); | 		compile_regexp_failed(p, error); | ||||||
|  |  | ||||||
| 	p->pcre1_extra_info = pcre_study(p->pcre1_regexp, PCRE_STUDY_JIT_COMPILE, &error); | 	p->pcre1_extra_info = pcre_study(p->pcre1_regexp, GIT_PCRE_STUDY_JIT_COMPILE, &error); | ||||||
| 	if (!p->pcre1_extra_info && error) | 	if (!p->pcre1_extra_info && error) | ||||||
| 		die("%s", error); | 		die("%s", error); | ||||||
|  |  | ||||||
|  |  | ||||||
							
								
								
									
										5
									
								
								grep.h
								
								
								
								
							
							
						
						
									
										5
									
								
								grep.h
								
								
								
								
							|  | @ -7,11 +7,12 @@ | ||||||
| #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32 | #if PCRE_MAJOR >= 8 && PCRE_MINOR >= 32 | ||||||
| #ifndef NO_LIBPCRE1_JIT | #ifndef NO_LIBPCRE1_JIT | ||||||
| #define GIT_PCRE1_USE_JIT | #define GIT_PCRE1_USE_JIT | ||||||
|  | #define GIT_PCRE_STUDY_JIT_COMPILE PCRE_STUDY_JIT_COMPILE | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
| #endif | #endif | ||||||
| #ifndef PCRE_STUDY_JIT_COMPILE | #ifndef GIT_PCRE_STUDY_JIT_COMPILE | ||||||
| #define PCRE_STUDY_JIT_COMPILE 0 | #define GIT_PCRE_STUDY_JIT_COMPILE 0 | ||||||
| #endif | #endif | ||||||
| #if PCRE_MAJOR <= 8 && PCRE_MINOR < 20 | #if PCRE_MAJOR <= 8 && PCRE_MINOR < 20 | ||||||
| typedef int pcre_jit_stack; | typedef int pcre_jit_stack; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Charles Bailey
						Charles Bailey