replace goto with loop (#1151)
This commit is contained in:
+5
-6
@@ -80,8 +80,7 @@ private:
|
|||||||
|
|
||||||
/* Cull or trim unused Topic nodes from leaf to root */
|
/* Cull or trim unused Topic nodes from leaf to root */
|
||||||
void trimTree(Topic *topic) {
|
void trimTree(Topic *topic) {
|
||||||
repeat:
|
while (!topic->subs.size() && !topic->children.size() && !topic->terminatingWildcardChild && !topic->wildcardChild) {
|
||||||
if (!topic->subs.size() && !topic->children.size() && !topic->terminatingWildcardChild && !topic->wildcardChild) {
|
|
||||||
Topic *parent = topic->parent;
|
Topic *parent = topic->parent;
|
||||||
|
|
||||||
if (topic->length == 1) {
|
if (topic->length == 1) {
|
||||||
@@ -114,11 +113,11 @@ private:
|
|||||||
delete [] topic->name;
|
delete [] topic->name;
|
||||||
delete topic;
|
delete topic;
|
||||||
|
|
||||||
if (parent != root) {
|
if (parent == root) {
|
||||||
topic = parent;
|
break;
|
||||||
goto repeat;
|
|
||||||
//trimTree(parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
topic = parent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user