summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2013-03-02 09:35:02 +0100
committerSebastien Helleu <flashcode@flashtux.org>2013-03-02 09:35:02 +0100
commit844ba9e1c07d0f17c0081d666591c5f2758078bf (patch)
tree97b440799d6b248b89676c4ff1c692c0c9bd4358 /src
parent11396b3266585b632385c58124d95e7a658ffded (diff)
downloadweechat-844ba9e1c07d0f17c0081d666591c5f2758078bf.zip
core: optimize function nicklist_remove_all (don't remove and create again "root" group)
Diffstat (limited to 'src')
-rw-r--r--src/gui/gui-nicklist.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c
index 7f55d38bb..be6fdb484 100644
--- a/src/gui/gui-nicklist.c
+++ b/src/gui/gui-nicklist.c
@@ -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->children);
+ }
+
+ /* remove nicks of root group */
+ while (buffer->nicklist_root->nicks)
{
- gui_nicklist_remove_group (buffer, buffer->nicklist_root);
+ gui_nicklist_remove_nick (buffer, buffer->nicklist_root->nicks);
}
- gui_nicklist_add_group (buffer, NULL, "root", NULL, 0);
}
}