From dc745c0b77716ee49a25881e323b3d562d7f3988 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Fri, 29 Jan 2021 10:30:05 +0100 Subject: [PATCH] tweaks: elide a function that is now just one line --- src/color.c | 8 +------- src/prototypes.h | 1 - src/winio.c | 4 ++-- 3 files changed, 3 insertions(+), 10 deletions(-) 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) {