You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by sc...@apache.org on 2019/01/08 00:18:08 UTC
[trafficserver] branch master updated: Fixes Clang-Analyzer issue
of H2 Dependence Tree
This is an automated email from the ASF dual-hosted git repository.
scw00 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git
The following commit(s) were added to refs/heads/master by this push:
new 97b1db7 Fixes Clang-Analyzer issue of H2 Dependence Tree
97b1db7 is described below
commit 97b1db7fd997937c884560a70d04c5cfecc1a8a8
Author: scw00 <sc...@apache.org>
AuthorDate: Mon Jan 7 19:15:23 2019 +0800
Fixes Clang-Analyzer issue of H2 Dependence Tree
---
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 7b71303..e7820d5 100644
--- a/proxy/http2/Http2DependencyTree.h
+++ b/proxy/http2/Http2DependencyTree.h
@@ -119,10 +119,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);
@@ -269,7 +269,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;
}
@@ -389,36 +389,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)) {
@@ -429,7 +429,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>