diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-06-04 21:12:51 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-06-05 07:29:01 +0200 |
commit | 615069caefb2505586c519927910aef3f62a7ac6 (patch) | |
tree | bd88684bd38e745e0dc22534c6db8b596375f379 /src/plugins/logger/logger-backlog.c | |
parent | 5e35ead044845c87a1e6dfa7f9938635609ca1b0 (diff) | |
download | weechat-615069caefb2505586c519927910aef3f62a7ac6.zip |
logger: return arraylist instead of custom linked list in logger_tail_file (issue #1926)
Diffstat (limited to 'src/plugins/logger/logger-backlog.c')
-rw-r--r-- | src/plugins/logger/logger-backlog.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/plugins/logger/logger-backlog.c b/src/plugins/logger/logger-backlog.c index c85999a36..9e8983b3c 100644 --- a/src/plugins/logger/logger-backlog.c +++ b/src/plugins/logger/logger-backlog.c @@ -132,22 +132,25 @@ void logger_backlog_file (struct t_gui_buffer *buffer, const char *filename, int lines) { - struct t_logger_line *last_lines, *ptr_lines; - int num_lines; - - weechat_buffer_set (buffer, "print_hooks_enabled", "0"); + struct t_arraylist *last_lines; + int i, num_lines; num_lines = 0; last_lines = logger_tail_file (filename, lines); - ptr_lines = last_lines; - while (ptr_lines) + if (!last_lines) + return; + + weechat_buffer_set (buffer, "print_hooks_enabled", "0"); + + num_lines = weechat_arraylist_size (last_lines); + for (i = 0; i < num_lines; i++) { - logger_backlog_display_line (buffer, ptr_lines->data); - num_lines++; - ptr_lines = ptr_lines->next_line; + logger_backlog_display_line ( + buffer, + (const char *)weechat_arraylist_get (last_lines, i)); } - if (last_lines) - logger_tail_free (last_lines); + weechat_arraylist_free (last_lines); + if (num_lines > 0) { weechat_printf_date_tags (buffer, 0, @@ -158,6 +161,7 @@ logger_backlog_file (struct t_gui_buffer *buffer, const char *filename, num_lines); weechat_buffer_set (buffer, "unread", ""); } + weechat_buffer_set (buffer, "print_hooks_enabled", "1"); } |