commit dc745c0b77716ee49a25881e323b3d562d7f3988
parent a8ed1d7a9a79af51ce306b32656f2a956bcff367
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 29 Jan 2021 10:30:05 +0100
tweaks: elide a function that is now just one line
Diffstat:
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git 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
@@ -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
@@ -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) {