{
filestruct *oof;
for (oof = fileptr->next; oof != NULL; oof = oof->next) {
+ alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
- if (oof->multidata[mindex] != 0)
+ if (oof->multidata[mindex] != CNONE)
oof->multidata[mindex] = -1;
else
break;
{
filestruct *oof;
for (oof = fileptr->prev; oof != NULL; oof = oof->prev) {
+ alloc_multidata_if_needed(oof);
if (oof->multidata == NULL)
continue;
- if (oof->multidata[mindex] != 0)
+ if (oof->multidata[mindex] != CNONE)
oof->multidata[mindex] = -1;
else
break;
if (tmpcolor->end == NULL)
continue;
+ alloc_multidata_if_needed(fileptr);
/* Figure out where the first begin and end are to determine if
things changed drastically for the precalculated multi values */
nobegin = regexec(tmpcolor->start, fileptr->data, 1, &startmatch, 0);
/* Next syntax. */
} syntaxtype;
-#define CNONE (1<<0)
+#define CNONE (1<<1)
/* Yay, regex doesn't apply to this line at all! */
-#define CBEGINBEFORE (1<<1)
+#define CBEGINBEFORE (1<<2)
/* regex starts on an earlier line, ends on this one */
-#define CENDAFTER (1<<2)
+#define CENDAFTER (1<<3)
/* regex sraers on this line and ends on a later one */
-#define CWHOLELINE (1<<3)
+#define CWHOLELINE (1<<4)
/* whole line engulfed by the regex start < me, end > me */
-#define CSTARTENDHERE (1<<4)
+#define CSTARTENDHERE (1<<5)
/* regex starts and ends within this line */
-#define CWTF (1<<5)
+#define CWTF (1<<6)
/* Something else */
#endif /* ENABLE_COLOR */
short color_to_short(const char *colorname, bool *bright);
void parse_colors(char *ptr, bool icase);
void reset_multis(filestruct *fileptr);
+void alloc_multidata_if_needed(filestruct *fileptr);
#endif
void parse_rcfile(FILE *rcstream
#ifdef ENABLE_COLOR
}
k = startmatch.rm_eo;
}
- } else if (fileptr->multidata != NULL && fileptr->multidata[tmpcolor->id] != 0) {
+ } else if (fileptr->multidata != NULL && fileptr->multidata[tmpcolor->id] != CNONE) {
/* This is a multi-line regex. There are two steps.
* First, we have to see if the beginning of the line is
* colored by a start on an earlier line, and an end on
short md = fileptr->multidata[tmpcolor->id];
if (md == -1)
- fileptr->multidata[tmpcolor->id] = 0; /* until we find out otherwise */
+ fileptr->multidata[tmpcolor->id] = CNONE; /* until we find out otherwise */
else if (md == CNONE)
continue;
else if (md == CWHOLELINE) {