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>
Nguyễn Thái Ngọc Duy committed
Jun 25, 2016 at 07:22 UTC
e944d9d932b3653debcfdd16eec2721eed0670e5
1 file changed
+1
-4
grep.c
+1
-4
@@ -442,11 +442,8 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
442
* simple string match using kws. p->fixed tells us if we
443
* want to use kws.
444
*/
445
- if (opt->fixed)
445
+ if (opt->fixed || is_fixed(p->pattern, p->patternlen))
446
p->fixed = !icase || ascii_only;
447
- else if ((!icase || ascii_only) &&
448
- is_fixed(p->pattern, p->patternlen))
449
- p->fixed = 1;
447
else
448
p->fixed = 0;
449