tweaks: be slightly more efficient in marking lines as WOULDBE

Take two conditions that are relevant only for a rather unlikely case
(a start match without a corresponding end match) out of an inner loop.
Give the case its own, dedicated loop.
master
Benno Schulenberg 2021-02-06 16:56:22 +01:00
parent 7e04fea92b
commit 53fe7ba26a
1 changed files with 3 additions and 6 deletions

View File

@ -310,12 +310,6 @@ void precalc_multicolorinfo(void)
for (line = openfile->filetop; line != NULL; line = line->next) {
int index = 0;
/* For an unpaired start match, mark each remaining line. */
if (line->prev && line->prev->multidata[ink->id] == WOULDBE) {
line->multidata[ink->id] = WOULDBE;
continue;
}
/* Assume nothing applies until proven otherwise below. */
line->multidata[ink->id] = NOTHING;
@ -350,7 +344,10 @@ void precalc_multicolorinfo(void)
1, &endmatch, 0) != 0)
tailline = tailline->next;
/* When there is no end match, mark relevant lines as such. */
if (tailline == NULL) {
for (; line->next != NULL; line = line->next)
line->multidata[ink->id] = WOULDBE;
line->multidata[ink->id] = WOULDBE;
break;
}