1
1

tweaks: elide a variable plus its corresponding dark logic

Just assign the 'CNONE' value upfront, instead of figuring out
at the end of the line whether anything has been assigned yet.

Also, the old logic would leave unmarked a line that contains a
start match without any terminating end match.  Not serious, but
not right.
Этот коммит содержится в:
Benno Schulenberg 2017-01-21 16:50:52 +01:00
родитель 1194a41cdb
Коммит 76d83070c4

Просмотреть файл

@ -413,13 +413,15 @@ void precalc_multicolorinfo(void)
continue;
for (fileptr = openfile->fileage; fileptr != NULL; fileptr = fileptr->next) {
int startx = 0, nostart = 0;
int startx = 0;
int linelen = strlen(fileptr->data);
alloc_multidata_if_needed(fileptr);
/* Assume nothing applies until proven otherwise below. */
fileptr->multidata[ink->id] = CNONE;
while ((nostart = regexec(ink->start, &fileptr->data[startx], 1,
&startmatch, (startx == 0) ? 0 : REG_NOTBOL)) == 0) {
while (regexec(ink->start, &fileptr->data[startx], 1,
&startmatch, (startx == 0) ? 0 : REG_NOTBOL) == 0) {
/* Look for an end, and start marking how many lines are
* encompassed, which should speed up rendering later. */
startx += startmatch.rm_eo;
@ -463,11 +465,6 @@ void precalc_multicolorinfo(void)
/* Skip to the end point of the match. */
startx = endmatch.rm_eo;
}
if (nostart && startx == 0) {
fileptr->multidata[ink->id] = CNONE;
continue;
}
}
}
}