replace goto with loop (#1151)

This commit is contained in:
Robert Nagy
2020-12-23 23:00:35 +01:00
committed by GitHub
parent 5b70871a08
commit cd33cd20ba
+5 -6
View File
@@ -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;
} }
} }