grep: rewrite an if/else condition to avoid duplicate expression
"!icase || ascii_only" is repeated twice in this if/else chain as this series evolves. Rewrite it (and basically revert the first if condition back to before the "grep: break down an "if" stmt..." commit). Helped-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
		 Nguyễn Thái Ngọc Duy
					Nguyễn Thái Ngọc Duy
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							793dc676e0
						
					
				
				
					commit
					e944d9d932
				
			
							
								
								
									
										5
									
								
								grep.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								grep.c
									
									
									
									
									
								
							| @ -442,11 +442,8 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt) | ||||
| 	 * simple string match using kws.  p->fixed tells us if we | ||||
| 	 * want to use kws. | ||||
| 	 */ | ||||
| 	if (opt->fixed) | ||||
| 	if (opt->fixed || is_fixed(p->pattern, p->patternlen)) | ||||
| 		p->fixed = !icase || ascii_only; | ||||
| 	else if ((!icase || ascii_only) && | ||||
| 		 is_fixed(p->pattern, p->patternlen)) | ||||
| 		p->fixed = 1; | ||||
| 	else | ||||
| 		p->fixed = 0; | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user