tweaks: try the allocation of a multidata cache just once per line

It does not need to be allocated for each multiline regex separately.
This commit is contained in:
Benno Schulenberg 2019-06-23 11:37:38 +02:00
parent bbab9e2e62
commit 21d0755de5

View File

@ -295,13 +295,13 @@ void check_the_multis(linestruct *line)
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
return;
alloc_multidata_if_needed(line);
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
/* If it's not a multiline regex, skip. */
if (ink->end == NULL)
continue;
alloc_multidata_if_needed(line);
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);