From 1fcb9b99cf547058b5246c338dd60170f8935e20 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 23 Jun 2019 12:28:13 +0200 Subject: [PATCH] tweaks: move a function to before the first one that calls it --- src/color.c | 18 +++++++++--------- src/proto.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/color.c b/src/color.c index 63ec20ba..5b0e05fc 100644 --- a/src/color.c +++ b/src/color.c @@ -282,6 +282,15 @@ void color_update(void) openfile->colorstrings = (sint == NULL ? NULL : sint->color); } +/* Allocate and initialize (for the given line) the cache for multiline info. */ +void set_up_multicache(linestruct *line) +{ + line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short)); + + for (int index = 0; index < openfile->syntax->nmultis; index++) + line->multidata[index] = -1; +} + /* 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) @@ -329,15 +338,6 @@ void check_the_multis(linestruct *line) } } -/* Allocate (for one line) the cache space for multiline color regexes. */ -void set_up_multicache(linestruct *line) -{ - line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short)); - - for (int index = 0; index < openfile->syntax->nmultis; index++) - line->multidata[index] = -1; -} - /* Precalculate the multi-line start and end regex info so we can * speed up rendering (with any hope at all...). */ void precalc_multicolorinfo(void) diff --git a/src/proto.h b/src/proto.h index 964f5c36..a5483500 100644 --- a/src/proto.h +++ b/src/proto.h @@ -242,8 +242,8 @@ bool is_valid_unicode(wchar_t wc); void set_colorpairs(void); void color_init(void); void color_update(void); -void check_the_multis(linestruct *line); void set_up_multicache(linestruct *line); +void check_the_multis(linestruct *line); void precalc_multicolorinfo(void); #endif