"!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 [off-list ref]
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
---
grep.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/grep.c b/grep.c
index 5a8c52a..4b6b7bc 100644
--- a/grep.c
+++ b/grep.c
@@ -426,11 +426,8 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
icase = opt->regflags & REG_ICASE || p->ignore_case;
ascii_only = !has_non_ascii(p->pattern);
- 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;
--
2.8.2.526.g02eed6d