core: optimize loop when closing several buffers with command /buffer close n1-n2
This commit is contained in:
parent
d1a89e9db0
commit
f435e8d3fa
@ -801,13 +801,13 @@ COMMAND_CALLBACK(buffer)
|
|||||||
{
|
{
|
||||||
error_main_buffer = 0;
|
error_main_buffer = 0;
|
||||||
num_buffers = 0;
|
num_buffers = 0;
|
||||||
for (i = number2; i >= number1; i--)
|
|
||||||
{
|
|
||||||
ptr_buffer = last_gui_buffer;
|
ptr_buffer = last_gui_buffer;
|
||||||
while (ptr_buffer)
|
while (ptr_buffer)
|
||||||
{
|
{
|
||||||
ptr_prev_buffer = ptr_buffer->prev_buffer;
|
ptr_prev_buffer = ptr_buffer->prev_buffer;
|
||||||
if (ptr_buffer->number == i)
|
if (ptr_buffer->number < number1)
|
||||||
|
break;
|
||||||
|
if (ptr_buffer->number <= number2)
|
||||||
{
|
{
|
||||||
num_buffers++;
|
num_buffers++;
|
||||||
if (ptr_buffer == weechat_buffer)
|
if (ptr_buffer == weechat_buffer)
|
||||||
@ -821,7 +821,6 @@ COMMAND_CALLBACK(buffer)
|
|||||||
}
|
}
|
||||||
ptr_buffer = ptr_prev_buffer;
|
ptr_buffer = ptr_prev_buffer;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
* display error for main buffer if it was the only
|
* display error for main buffer if it was the only
|
||||||
* buffer to close with matching number
|
* buffer to close with matching number
|
||||||
|
Loading…
x
Reference in New Issue
Block a user