summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/treeserver.cpp22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/modules/m_spanningtree/treeserver.cpp b/src/modules/m_spanningtree/treeserver.cpp
index 38d91f54c..060c958d7 100644
--- a/src/modules/m_spanningtree/treeserver.cpp
+++ b/src/modules/m_spanningtree/treeserver.cpp
@@ -333,21 +333,17 @@ bool TreeServer::DelChild(TreeServer* Child)
*/
bool TreeServer::Tidy()
{
- bool stillchildren = true;
- while (stillchildren)
+ while (1)
{
- stillchildren = false;
- for (std::vector<TreeServer*>::iterator a = Children.begin(); a != Children.end(); a++)
- {
- TreeServer* s = (TreeServer*)*a;
- s->Tidy();
- Children.erase(a);
- delete s;
- stillchildren = true;
- break;
- }
+ std::vector<TreeServer*>::iterator a = Children.begin();
+ if (a == Children.end())
+ return true;
+ TreeServer* s = *a;
+ s->Tidy();
+ s->cull();
+ Children.erase(a);
+ delete s;
}
- return true;
}
CullResult TreeServer::cull()