grep: inline the return value of a function call used only once

Since e944d9d932 ("grep: rewrite an if/else condition to avoid duplicate expression", 2016-06-25) the "ascii_only" variable has only been used once in compile_regexp(), let's just inline it there. This makes the code easier to read, and might make it marginally faster depending on compiler optimizations. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed Jul 1, 2019 at 23:20 UTC f463beb805638830e2a6b16359f94d8afca289ee
1 file changed +1 -3
grep.c
+1 -3
@@ -650,13 +650,11 @@ static void compile_fixed_regexp(struct grep_pat *p, struct grep_opt *opt)
650
651 static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
652 {
653 - int ascii_only;
653 int err;
654 int regflags = REG_NEWLINE;
655
656 p->word_regexp = opt->word_regexp;
657 p->ignore_case = opt->ignore_case;
659 - ascii_only = !has_non_ascii(p->pattern);
658
659 /*
660 * Even when -F (fixed) asks us to do a non-regexp search, we
@@ -673,7 +671,7 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
671 if (opt->fixed ||
672 has_null(p->pattern, p->patternlen) ||
673 is_fixed(p->pattern, p->patternlen))
676 - p->fixed = !p->ignore_case || ascii_only;
674 + p->fixed = !p->ignore_case || !has_non_ascii(p->pattern);
675
676 if (p->fixed) {
677 p->kws = kwsalloc(p->ignore_case ? tolower_trans_tbl : NULL);