Taylor Blau <m...@ttaylorr.com> writes:

>> Just initializing match_color where it is defined at the beginning of
>> show_line() should be sufficient, I think.
>
> I think that we could also use the following, and leave the `if
> (opt->color)` conditional where it is:
>
> diff --git a/grep.c b/grep.c
> index 48cca6723e..b985fb3ee0 100644
> --- a/grep.c
> +++ b/grep.c
> @@ -1448,7 +1448,7 @@ static void show_line(struct grep_opt *opt, char *bol, 
> char *eol,
>                     const char *name, unsigned lno, ssize_t cno, char sign)
>  {
>       int rest = eol - bol;
> -     const char *match_color, *line_color = NULL;
> +     const char *match_color = NULL, *line_color = NULL;
>
>       if (opt->file_break && opt->last_shown == 0) {
>               if (opt->show_hunk_mark)

You say "we could also", but the above is exactly what I suggested,
so we seem to be on the same page, which is good ;-)

Reply via email to