1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-01 23:36:37 +02:00

core: optimize function nicklist_remove_all (don't remove and create again "root" group)

This commit is contained in:
Sebastien Helleu
2013-03-02 09:35:02 +01:00
parent 11396b3266
commit 844ba9e1c0
+10 -4
View File
@@ -544,13 +544,19 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer,
void
gui_nicklist_remove_all (struct t_gui_buffer *buffer)
{
if (buffer)
if (buffer && buffer->nicklist_root)
{
while (buffer->nicklist_root)
/* remove children of root group */
while (buffer->nicklist_root->children)
{
gui_nicklist_remove_group (buffer, buffer->nicklist_root);
gui_nicklist_remove_group (buffer, buffer->nicklist_root->children);
}
/* remove nicks of root group */
while (buffer->nicklist_root->nicks)
{
gui_nicklist_remove_nick (buffer, buffer->nicklist_root->nicks);
}
gui_nicklist_add_group (buffer, NULL, "root", NULL, 0);
}
}