tweaks: try the allocation of a multidata cache just once per line
It does not need to be allocated for each multiline regex separately.
Этот коммит содержится в:
родитель
bbab9e2e62
Коммит
21d0755de5
@ -295,13 +295,13 @@ void check_the_multis(linestruct *line)
|
|||||||
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
if (openfile->syntax == NULL || openfile->syntax->nmultis == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
alloc_multidata_if_needed(line);
|
||||||
|
|
||||||
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
for (ink = openfile->colorstrings; ink != NULL; ink = ink->next) {
|
||||||
/* If it's not a multiline regex, skip. */
|
/* If it's not a multiline regex, skip. */
|
||||||
if (ink->end == NULL)
|
if (ink->end == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
alloc_multidata_if_needed(line);
|
|
||||||
|
|
||||||
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
|
astart = (regexec(ink->start, line->data, 1, &startmatch, 0) == 0);
|
||||||
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
|
afterstart = line->data + (astart ? startmatch.rm_eo : 0);
|
||||||
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
anend = (regexec(ink->end, afterstart, 1, &endmatch, 0) == 0);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user