Commit 76d83070 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 5 additions and 8 deletions
+5 -8
......@@ -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;
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment