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));
for (int index = 0; index < openfile->syntax->nmultis; index++)
for (short index = 0; index < openfile->syntax->nmultis; index++)
line->multidata[index] = -1;
}

View File

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