tweaks: change an integer to a short, and reshuffle it for better packing

A short allows for more than 32 thousand values, and the maximum number
of multiline regexes in any of the current syntaxes is... just four.

Reshuffle it to the beginning also because it is used the most often.
master
Benno Schulenberg 2020-03-02 19:36:10 +01:00
parent 89217f20af
commit 72ad00f9d0
2 changed files with 7 additions and 7 deletions

View File

@ -266,7 +266,7 @@ void set_up_multicache(linestruct *line)
{ {
line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short)); line->multidata = (short *)nmalloc(openfile->syntax->nmultis * sizeof(short));
for (int index = 0; index < openfile->syntax->nmultis; index++) for (short index = 0; index < openfile->syntax->nmultis; index++)
line->multidata[index] = -1; line->multidata[index] = -1;
} }

View File

@ -178,10 +178,12 @@ typedef enum {
/* Structure types. */ /* Structure types. */
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
typedef struct colortype { typedef struct colortype {
short id;
/* An ordinal number (if this color combo is for a multiline regex). */
short fg; short fg;
/* This syntax's foreground color. */ /* This combo's foreground color. */
short bg; short bg;
/* This syntax's background color. */ /* This combo's background color. */
short pairnum; short pairnum;
/* The pair number for this foreground/background color combination. */ /* The pair number for this foreground/background color combination. */
int attributes; int attributes;
@ -191,9 +193,7 @@ typedef struct colortype {
regex_t *end; regex_t *end;
/* The compiled regular expression for 'end=', if any. */ /* The compiled regular expression for 'end=', if any. */
struct colortype *next; struct colortype *next;
/* Next set of colors. */ /* Next color combination. */
int id;
/* Basic id for assigning to lines later. */
} colortype; } colortype;
typedef struct regexlisttype { typedef struct regexlisttype {
@ -241,7 +241,7 @@ typedef struct syntaxtype {
#endif #endif
colortype *color; colortype *color;
/* The colors and their regexes used in this syntax. */ /* The colors and their regexes used in this syntax. */
int nmultis; short nmultis;
/* How many multiline regex strings this syntax has. */ /* How many multiline regex strings this syntax has. */
struct syntaxtype *next; struct syntaxtype *next;
/* Next syntax. */ /* Next syntax. */