tweaks: remove an unneeded element from the openfilestruct

master
Benno Schulenberg 2020-05-01 12:38:02 +02:00
parent e64e54d57f
commit 9c4ebed3ff
5 changed files with 9 additions and 13 deletions

View File

@ -116,7 +116,7 @@ void prepare_palette(void)
#endif #endif
/* For each coloring expression, initialize the color pair. */ /* For each coloring expression, initialize the color pair. */
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) { for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
foreground = ink->fg; foreground = ink->fg;
background = ink->bg; background = ink->bg;
@ -249,7 +249,6 @@ void find_and_prime_applicable_syntax(void)
} }
openfile->syntax = sntx; openfile->syntax = sntx;
openfile->colorstrings = (sntx == NULL ? NULL : sntx->color);
} }
/* Allocate and initialize (for the given line) the cache for multiline info. */ /* Allocate and initialize (for the given line) the cache for multiline info. */
@ -277,7 +276,7 @@ void check_the_multis(linestruct *line)
if (line->multidata == NULL) if (line->multidata == NULL)
set_up_multicache(line); set_up_multicache(line);
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) { for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
/* If it's not a multiline regex, skip. */ /* If it's not a multiline regex, skip. */
if (ink->end == NULL) if (ink->end == NULL)
continue; continue;
@ -316,14 +315,14 @@ void precalc_multicolorinfo(void)
regmatch_t startmatch, endmatch; regmatch_t startmatch, endmatch;
linestruct *line, *tailline; linestruct *line, *tailline;
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX)) if (openfile->syntax == NULL || ISSET(NO_COLOR_SYNTAX))
return; return;
/* For each line, allocate cache space for the multiline-regex info. */ /* For each line, allocate cache space for the multiline-regex info. */
for (line = openfile->filetop; line != NULL; line = line->next) for (line = openfile->filetop; line != NULL; line = line->next)
set_up_multicache(line); set_up_multicache(line);
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) { for (ink = openfile->syntax->color; ink != NULL; ink = ink->next) {
/* If this is not a multi-line regex, skip it. */ /* If this is not a multi-line regex, skip it. */
if (ink->end == NULL) if (ink->end == NULL)
continue; continue;

View File

@ -97,7 +97,6 @@ void make_new_buffer(void)
#endif #endif
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
openfile->syntax = NULL; openfile->syntax = NULL;
openfile->colorstrings = NULL;
#endif #endif
} }

View File

@ -403,9 +403,7 @@ typedef struct openfilestruct {
/* Whether the file has been modified. */ /* Whether the file has been modified. */
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
syntaxtype *syntax; syntaxtype *syntax;
/* The syntax struct for this file, if any. */ /* The syntax that applies to this file, if any. */
colortype *colorstrings;
/* The file's associated colors. */
#endif #endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
struct openfilestruct *next; struct openfilestruct *next;

View File

@ -646,7 +646,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
/* When doing syntax coloring, the replacement might require /* When doing syntax coloring, the replacement might require
* a change of colors, so refresh the whole edit window. */ * a change of colors, so refresh the whole edit window. */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) if (openfile->syntax && !ISSET(NO_COLOR_SYNTAX))
edit_refresh(); edit_refresh();
else else
#endif #endif

View File

@ -2422,8 +2422,8 @@ void draw_row(int row, const char *converted, linestruct *line, size_t from_col)
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
/* If color syntaxes are available and turned on, apply them. */ /* If color syntaxes are available and turned on, apply them. */
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX)) { if (openfile->syntax && !ISSET(NO_COLOR_SYNTAX)) {
const colortype *varnish = openfile->colorstrings; const colortype *varnish = openfile->syntax->color;
/* If there are multiline regexes, make sure there is a cache. */ /* If there are multiline regexes, make sure there is a cache. */
if (openfile->syntax->nmultis > 0 && line->multidata == NULL) if (openfile->syntax->nmultis > 0 && line->multidata == NULL)
@ -3259,7 +3259,7 @@ void edit_refresh(void)
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
/* When needed and useful, initialize the colors for the current syntax. */ /* When needed and useful, initialize the colors for the current syntax. */
if (!have_palette && has_colors()) if (openfile->syntax && !have_palette && !ISSET(NO_COLOR_SYNTAX) && has_colors())
prepare_palette(); prepare_palette();
#endif #endif