From: Stephan Bosch Date: Wed, 9 Oct 2019 01:49:33 +0000 (+0200) Subject: iputils.hh: NetmaskTree: Make cleanup_tree() method private. X-Git-Tag: auth-4.3.0-beta2~20^2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b0ae5c8d3e5d5ceaebf80228d7d4866a9587421;p=thirdparty%2Fpdns.git iputils.hh: NetmaskTree: Make cleanup_tree() method private. --- diff --git a/pdns/iputils.hh b/pdns/iputils.hh index f3537e042f..1697aaf707 100644 --- a/pdns/iputils.hh +++ b/pdns/iputils.hh @@ -684,6 +684,24 @@ private: int d_bits; //left || node->right || node->node6 || node->node4)) { + // get parent node ptr + TreeNode* pparent = node->parent; + // delete this node + if (pparent) { + if (pparent->left.get() == node) + pparent->left.reset(); + else + pparent->right.reset(); + // now recurse up to the parent + cleanup_tree(pparent); + } + } + } + public: NetmaskTree() noexcept : NetmaskTree(false) { } @@ -852,24 +870,6 @@ public: return ret; } - void cleanup_tree(TreeNode* node) - { - // only cleanup this node if it has no children and node4 and node6 are both empty - if (!(node->left || node->right || node->node6 || node->node4)) { - // get parent node ptr - TreeNode* pparent = node->parent; - // delete this node - if (pparent) { - if (pparent->left.get() == node) - pparent->left.reset(); - else - pparent->right.reset(); - // now recurse up to the parent - cleanup_tree(pparent); - } - } - } - //