mirror of
https://github.com/irssi/irssi.git
synced 2026-08-19 16:42:30 +02:00
Merge pull request #715 from dequis/lastlog-glist-performance
Performance improvements for /lastlog
This commit is contained in:
commit
3246001fb4
1 changed files with 7 additions and 4 deletions
|
|
@ -610,27 +610,30 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
|
||||||
pre_line = line;
|
pre_line = line;
|
||||||
for (i = 0; i < before; i++) {
|
for (i = 0; i < before; i++) {
|
||||||
if (pre_line->prev == NULL ||
|
if (pre_line->prev == NULL ||
|
||||||
g_list_find(matches, pre_line->prev) != NULL)
|
g_list_nth_data(matches, 0) == pre_line->prev ||
|
||||||
|
g_list_nth_data(matches, 1) == pre_line->prev)
|
||||||
break;
|
break;
|
||||||
pre_line = pre_line->prev;
|
pre_line = pre_line->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (; pre_line != line; pre_line = pre_line->next)
|
for (; pre_line != line; pre_line = pre_line->next)
|
||||||
matches = g_list_append(matches, pre_line);
|
matches = g_list_prepend(matches, pre_line);
|
||||||
|
|
||||||
match_after = after;
|
match_after = after;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_matched || match_after > 0) {
|
if (line_matched || match_after > 0) {
|
||||||
/* matched */
|
/* matched */
|
||||||
matches = g_list_append(matches, line);
|
matches = g_list_prepend(matches, line);
|
||||||
|
|
||||||
if ((!line_matched && --match_after == 0) ||
|
if ((!line_matched && --match_after == 0) ||
|
||||||
(line_matched && match_after == 0 && before > 0))
|
(line_matched && match_after == 0 && before > 0))
|
||||||
matches = g_list_append(matches, NULL);
|
matches = g_list_prepend(matches, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
matches = g_list_reverse(matches);
|
||||||
|
|
||||||
#ifdef USE_GREGEX
|
#ifdef USE_GREGEX
|
||||||
if (preg != NULL)
|
if (preg != NULL)
|
||||||
g_regex_unref(preg);
|
g_regex_unref(preg);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue