diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2016-06-25 07:22:32 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-07-01 12:44:57 -0700 |
commit | e944d9d932b3653debcfdd16eec2721eed0670e5 (patch) | |
tree | 0477bcb979253c7ae0038267b61553278317a0f2 | |
parent | 793dc676e08394ed15bffe0ed66606ff9ced1c6a (diff) | |
download | git-e944d9d932b3653debcfdd16eec2721eed0670e5.tar.gz git-e944d9d932b3653debcfdd16eec2721eed0670e5.tar.xz |
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>
-rw-r--r-- | grep.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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; |