diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-03 17:01:52 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-03 17:01:52 +0100 |
commit | 189eb5dc409378cab2a5694b05ed2e15e5043c1f (patch) | |
tree | 3ea704ee450b73ab1685fed72f81f0035dce1f4a /src/core | |
parent | 9ee0955d6b204999c6ec69ea0d87010c07c6646c (diff) | |
download | weechat-189eb5dc409378cab2a5694b05ed2e15e5043c1f.zip |
core: add variable list_size to prevent computing arraylist size in each iteration
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/wee-command.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index 2e5c77764..24e997796 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -584,7 +584,7 @@ COMMAND_CALLBACK(buffer) struct t_arraylist *buffers_to_close; long number, number1, number2, numbers[3]; char *error, *value, *pos, *str_number1, *pos_number2; - int i, count, prev_number, clear_number; + int i, count, prev_number, clear_number, list_size; int buffer_found, arg_name, type_free, switch_to_buffer; /* make C compiler happy */ @@ -1122,7 +1122,8 @@ COMMAND_CALLBACK(buffer) weechat_buffer = gui_buffer_search_main (); - for (i = 0; i < arraylist_size (buffers_to_close); i++) + list_size = arraylist_size (buffers_to_close); + for (i = 0; i < list_size; i++) { ptr_buffer = (struct t_gui_buffer *)arraylist_get (buffers_to_close, i); |