mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:57:47 +00:00
AK: Avoid else after return in files commonly included by the Kernel
This commit is contained in:
parent
07f4e91b94
commit
e982253c33
3 changed files with 28 additions and 38 deletions
|
@ -118,9 +118,9 @@ protected:
|
|||
{
|
||||
Node* candidate = nullptr;
|
||||
while (node) {
|
||||
if (key == node->key) {
|
||||
if (key == node->key)
|
||||
return node;
|
||||
} else if (key < node->key) {
|
||||
if (key < node->key) {
|
||||
node = node->left_child;
|
||||
} else {
|
||||
candidate = node;
|
||||
|
@ -137,11 +137,10 @@ protected:
|
|||
Node* temp = m_root;
|
||||
while (temp) {
|
||||
parent = temp;
|
||||
if (node->key < temp->key) {
|
||||
if (node->key < temp->key)
|
||||
temp = temp->left_child;
|
||||
} else {
|
||||
else
|
||||
temp = temp->right_child;
|
||||
}
|
||||
}
|
||||
if (!parent) { // new root
|
||||
node->color = Color::Black;
|
||||
|
@ -149,11 +148,11 @@ protected:
|
|||
m_size = 1;
|
||||
m_minimum = node;
|
||||
return;
|
||||
} else if (node->key < parent->key) { // we are the left child
|
||||
parent->left_child = node;
|
||||
} else { // we are the right child
|
||||
parent->right_child = node;
|
||||
}
|
||||
if (node->key < parent->key) // we are the left child
|
||||
parent->left_child = node;
|
||||
else // we are the right child
|
||||
parent->right_child = node;
|
||||
node->parent = parent;
|
||||
|
||||
if (node->parent->parent) // no fixups to be done for a height <= 2 tree
|
||||
|
@ -351,14 +350,13 @@ protected:
|
|||
while (node->left_child)
|
||||
node = node->left_child;
|
||||
return node;
|
||||
} else {
|
||||
auto temp = node->parent;
|
||||
while (temp && node == temp->right_child) {
|
||||
node = temp;
|
||||
temp = temp->parent;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
auto temp = node->parent;
|
||||
while (temp && node == temp->right_child) {
|
||||
node = temp;
|
||||
temp = temp->parent;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
static Node* predecessor(Node* node)
|
||||
|
@ -369,14 +367,13 @@ protected:
|
|||
while (node->right_child)
|
||||
node = node->right_child;
|
||||
return node;
|
||||
} else {
|
||||
auto temp = node->parent;
|
||||
while (temp && node == temp->left_child) {
|
||||
node = temp;
|
||||
temp = temp->parent;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
auto temp = node->parent;
|
||||
while (temp && node == temp->left_child) {
|
||||
node = temp;
|
||||
temp = temp->parent;
|
||||
}
|
||||
return temp;
|
||||
}
|
||||
|
||||
Node* m_root { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue