diff --git a/src/color.c b/src/color.c index 53f04481..fa9cc99b 100644 --- a/src/color.c +++ b/src/color.c @@ -231,12 +231,6 @@ void find_and_prime_applicable_syntax(void) openfile->syntax = sntx; } -/* Allocate and initialize (for the given line) the cache for multiline info. */ -void set_up_multicache(linestruct *line) -{ - line->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short)); -} - /* Determine whether the matches of multiline regexes are still the same, * and if not, schedule a screen refresh, so things will be repainted. */ void check_the_multis(linestruct *line) @@ -308,7 +302,7 @@ void precalc_multicolorinfo(void) /* For each line, allocate cache space for the multiline-regex info. */ for (line = openfile->filetop; line != NULL; line = line->next) - set_up_multicache(line); + line->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short)); for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) { /* If this is not a multi-line regex, skip it. */ diff --git a/src/prototypes.h b/src/prototypes.h index 86d46840..18a2fca5 100644 --- a/src/prototypes.h +++ b/src/prototypes.h @@ -239,7 +239,6 @@ bool is_valid_unicode(wchar_t wc); void set_interface_colorpairs(void); void prepare_palette(void); void find_and_prime_applicable_syntax(void); -void set_up_multicache(linestruct *line); void check_the_multis(linestruct *line); void precalc_multicolorinfo(void); #endif diff --git a/src/winio.c b/src/winio.c index 1aaee53e..0b0db015 100644 --- a/src/winio.c +++ b/src/winio.c @@ -2482,9 +2482,9 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col) if (openfile->syntax && !ISSET(NO_SYNTAX)) { const colortype *varnish = openfile->syntax->color; - /* If there are multiline regexes, make sure there is a cache. */ + /* If there are multiline regexes, make sure this line has a cache. */ if (openfile->syntax->nmultis > 0 && line->multidata == NULL) - set_up_multicache(line); + line->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short)); /* Iterate through all the coloring regexes. */ for (; varnish != NULL; varnish = varnish->next) {