diff options
author | dequis <dx@dxzone.com.ar> | 2017-06-05 18:04:20 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2017-06-05 18:11:47 -0300 |
commit | e498265328bd619b231ea4c985734ea43bf89696 (patch) | |
tree | a256e0b681d42cbf2884484c2cdfd3100df41b97 | |
parent | 0e44ea891645044f47bf3754e141045ee3b24324 (diff) | |
download | irssi-e498265328bd619b231ea4c985734ea43bf89696.zip |
Performance improvements for /lastlog -before
This avoids the use of g_list_find() to find if a match was already
added to the list of results, by checking the last two added matches
instead.
Checking just the last match isn't enough because a NULL match is added
as a separator (shown as -- in the UI)
-rw-r--r-- | src/fe-text/textbuffer.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c index fdb95451..1f587f97 100644 --- a/src/fe-text/textbuffer.c +++ b/src/fe-text/textbuffer.c @@ -610,7 +610,8 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline, pre_line = line; for (i = 0; i < before; i++) { 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; pre_line = pre_line->prev; } |