This is an automated email from the ASF dual-hosted git repository.
zwoop pushed a commit to branch 7.1.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/7.1.x by this push:
new 296c51f Fixes Clang-Analyzer issue of H2 Dependence Tree
296c51f is described below
commit 296c51f59a049908ebda1a1ee268ad0dde2c8b8a
Author: scw00 <[email protected]>
AuthorDate: Mon Jan 7 19:15:23 2019 +0800
Fixes Clang-Analyzer issue of H2 Dependence Tree
(cherry picked from commit 97b1db7fd997937c884560a70d04c5cfecc1a8a8)
---
proxy/http2/Http2DependencyTree.h | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/proxy/http2/Http2DependencyTree.h
b/proxy/http2/Http2DependencyTree.h
index 51f34a5..f28ceb8 100644
--- a/proxy/http2/Http2DependencyTree.h
+++ b/proxy/http2/Http2DependencyTree.h
@@ -120,10 +120,10 @@ public:
Node *find(uint32_t id, bool *is_max_leaf = nullptr);
Node *find_shadow(uint32_t id, bool *is_max_leaf = nullptr);
Node *add(uint32_t parent_id, uint32_t id, uint32_t weight, bool exclusive,
T t, bool shadow = false);
- void remove(Node *node);
- void reprioritize(uint32_t new_parent_id, uint32_t id, bool exclusive);
- void reprioritize(Node *node, uint32_t id, bool exclusive);
+ Node *reprioritize(uint32_t new_parent_id, uint32_t id, bool exclusive);
+ Node *reprioritize(Node *node, uint32_t id, bool exclusive);
Node *top();
+ void remove(Node *node);
void activate(Node *node);
void deactivate(Node *node, uint32_t sent);
void update(Node *node, uint32_t sent);
@@ -270,7 +270,7 @@ Tree<T>::add(uint32_t parent_id, uint32_t id, uint32_t
weight, bool exclusive, T
node->weight = weight;
node->shadow = false;
// Move the shadow node into the proper position in the tree
- reprioritize(node, parent_id, exclusive);
+ node = reprioritize(node, parent_id, exclusive);
return node;
}
@@ -390,36 +390,36 @@ Tree<T>::remove(Node *node)
}
template <typename T>
-void
+Node *
Tree<T>::reprioritize(uint32_t id, uint32_t new_parent_id, bool exclusive)
{
Node *node = find(id);
if (node == nullptr) {
- return;
+ return node;
}
- reprioritize(node, new_parent_id, exclusive);
+ return reprioritize(node, new_parent_id, exclusive);
}
template <typename T>
-void
+Node *
Tree<T>::reprioritize(Node *node, uint32_t new_parent_id, bool exclusive)
{
if (node == nullptr) {
- return;
+ return node;
}
Node *old_parent = node->parent;
if (old_parent->id == new_parent_id) {
// Do nothing
- return;
+ return node;
}
// should not change the root node
ink_assert(node->parent);
Node *new_parent = find(new_parent_id);
if (new_parent == nullptr) {
- return;
+ return node;
}
// If node is dependent on the new parent, must move the new parent first
if (new_parent_id != 0 && in_parent_chain(node, new_parent)) {
@@ -430,7 +430,10 @@ Tree<T>::reprioritize(Node *node, uint32_t new_parent_id,
bool exclusive)
// delete the shadow node
if (node->is_shadow() && node->children.empty() && node->queue->empty()) {
remove(node);
+ return nullptr;
}
+
+ return node;
}
template <typename T>