mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
AK: Avoid else after return in files commonly included by the Kernel
This commit is contained in:
parent
07f4e91b94
commit
e982253c33
Notes:
sideshowbarker
2024-07-18 01:08:19 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/e982253c33b Pull-request: https://github.com/SerenityOS/serenity/pull/10737 Reviewed-by: https://github.com/BenWiederhake Reviewed-by: https://github.com/PeterBindels-TomTom Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/dascandy Reviewed-by: https://github.com/trflynn89
3 changed files with 28 additions and 38 deletions
|
@ -51,7 +51,6 @@ template<typename T>
|
|||
{
|
||||
if (order == memory_order_acq_rel || order == memory_order_release)
|
||||
return __atomic_compare_exchange_n(var, &expected, desired, false, memory_order_release, memory_order_acquire);
|
||||
else
|
||||
return __atomic_compare_exchange_n(var, &expected, desired, false, order, order);
|
||||
}
|
||||
|
||||
|
@ -60,7 +59,6 @@ template<typename T, typename V = RemoveVolatile<T>>
|
|||
{
|
||||
if (order == memory_order_acq_rel || order == memory_order_release)
|
||||
return __atomic_compare_exchange_n(var, &expected, desired, false, memory_order_release, memory_order_acquire);
|
||||
else
|
||||
return __atomic_compare_exchange_n(var, &expected, desired, false, order, order);
|
||||
}
|
||||
|
||||
|
@ -69,7 +67,6 @@ template<typename T, typename V = RemoveVolatile<T>>
|
|||
{
|
||||
if (order == memory_order_acq_rel || order == memory_order_release)
|
||||
return __atomic_compare_exchange_n(const_cast<V**>(var), &expected, nullptr, false, memory_order_release, memory_order_acquire);
|
||||
else
|
||||
return __atomic_compare_exchange_n(const_cast<V**>(var), &expected, nullptr, false, order, order);
|
||||
}
|
||||
|
||||
|
@ -174,7 +171,6 @@ public:
|
|||
{
|
||||
if (order == memory_order_acq_rel || order == memory_order_release)
|
||||
return __atomic_compare_exchange(&m_value, &expected, &desired, false, memory_order_release, memory_order_acquire);
|
||||
else
|
||||
return __atomic_compare_exchange(&m_value, &expected, &desired, false, order, order);
|
||||
}
|
||||
|
||||
|
@ -238,7 +234,6 @@ public:
|
|||
{
|
||||
if (order == memory_order_acq_rel || order == memory_order_release)
|
||||
return __atomic_compare_exchange_n(&m_value, &expected, desired, false, memory_order_release, memory_order_acquire);
|
||||
else
|
||||
return __atomic_compare_exchange_n(&m_value, &expected, desired, false, order, order);
|
||||
}
|
||||
|
||||
|
@ -369,7 +364,6 @@ public:
|
|||
{
|
||||
if (order == memory_order_acq_rel || order == memory_order_release)
|
||||
return __atomic_compare_exchange_n(&m_value, &expected, desired, false, memory_order_release, memory_order_acquire);
|
||||
else
|
||||
return __atomic_compare_exchange_n(&m_value, &expected, desired, false, order, order);
|
||||
}
|
||||
|
||||
|
|
|
@ -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,23 +137,22 @@ 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;
|
||||
m_root = node;
|
||||
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,7 +350,7 @@ protected:
|
|||
while (node->left_child)
|
||||
node = node->left_child;
|
||||
return node;
|
||||
} else {
|
||||
}
|
||||
auto temp = node->parent;
|
||||
while (temp && node == temp->right_child) {
|
||||
node = temp;
|
||||
|
@ -359,7 +358,6 @@ protected:
|
|||
}
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
static Node* predecessor(Node* node)
|
||||
{
|
||||
|
@ -369,7 +367,7 @@ protected:
|
|||
while (node->right_child)
|
||||
node = node->right_child;
|
||||
return node;
|
||||
} else {
|
||||
}
|
||||
auto temp = node->parent;
|
||||
while (temp && node == temp->left_child) {
|
||||
node = temp;
|
||||
|
@ -377,7 +375,6 @@ protected:
|
|||
}
|
||||
return temp;
|
||||
}
|
||||
}
|
||||
|
||||
Node* m_root { nullptr };
|
||||
size_t m_size { 0 };
|
||||
|
|
|
@ -141,8 +141,7 @@ constexpr bool is_constant_evaluated()
|
|||
constexpr type abs(type num) \
|
||||
{ \
|
||||
if (is_constant_evaluated()) \
|
||||
return num < zero ? -num : num; \
|
||||
else \
|
||||
return num < (zero) ? -num : num; \
|
||||
return __builtin_##intrinsic(num); \
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue