Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks

This commit is contained in:
Rémi Verschelde
2021-05-04 14:41:06 +02:00
parent 64a63e0861
commit b5e1e05ef2
1439 changed files with 1 additions and 34187 deletions

View File

@ -39,7 +39,6 @@
template <class T, class C = Comparator<T>, class A = DefaultAllocator>
class Set {
enum Color {
RED,
BLACK
@ -48,7 +47,6 @@ class Set {
public:
class Element {
private:
friend class Set<T, C, A>;
int color;
@ -62,19 +60,15 @@ public:
public:
const Element *next() const {
return _next;
}
Element *next() {
return _next;
}
const Element *prev() const {
return _prev;
}
Element *prev() {
return _prev;
}
const T &get() const {
@ -92,7 +86,6 @@ public:
private:
struct _Data {
Element *_root;
Element *_nil;
int size_cache;
@ -110,14 +103,12 @@ private:
}
void _create_root() {
_root = memnew_allocator(Element, A);
_root->parent = _root->left = _root->right = _nil;
_root->color = BLACK;
}
void _free_root() {
if (_root) {
memdelete_allocator<Element, A>(_root);
_root = NULL;
@ -125,7 +116,6 @@ private:
}
~_Data() {
_free_root();
#ifdef GLOBALNIL_DISABLED
@ -137,13 +127,11 @@ private:
_Data _data;
inline void _set_color(Element *p_node, int p_color) {
ERR_FAIL_COND(p_node == _data._nil && p_color == RED);
p_node->color = p_color;
}
inline void _rotate_left(Element *p_node) {
Element *r = p_node->right;
p_node->right = r->left;
if (r->left != _data._nil)
@ -159,7 +147,6 @@ private:
}
inline void _rotate_right(Element *p_node) {
Element *l = p_node->left;
p_node->left = l->right;
if (l->right != _data._nil)
@ -175,18 +162,15 @@ private:
}
inline Element *_successor(Element *p_node) const {
Element *node = p_node;
if (node->right != _data._nil) {
node = node->right;
while (node->left != _data._nil) { /* returns the minimum of the right subtree of node */
node = node->left;
}
return node;
} else {
while (node == node->parent->right) {
node = node->parent;
}
@ -201,14 +185,12 @@ private:
Element *node = p_node;
if (node->left != _data._nil) {
node = node->left;
while (node->right != _data._nil) { /* returns the minimum of the left subtree of node */
node = node->right;
}
return node;
} else {
while (node == node->parent->left) {
node = node->parent;
}
@ -220,7 +202,6 @@ private:
}
Element *_find(const T &p_value) const {
Element *node = _data._root->left;
C less;
@ -237,7 +218,6 @@ private:
}
Element *_lower_bound(const T &p_value) const {
Element *node = _data._root->left;
Element *prev = NULL;
C less;
@ -263,7 +243,6 @@ private:
}
void _insert_rb_fix(Element *p_new_node) {
Element *node = p_new_node;
Element *nparent = node->parent;
Element *ngrand_parent;
@ -312,13 +291,11 @@ private:
}
Element *_insert(const T &p_value) {
Element *new_parent = _data._root;
Element *node = _data._root->left;
C less;
while (node != _data._nil) {
new_parent = node;
if (less(p_value, node->value))
@ -356,7 +333,6 @@ private:
}
void _erase_fix_rb(Element *p_node) {
Element *root = _data._root->left;
Element *node = _data._nil;
Element *sibling = p_node;
@ -418,7 +394,6 @@ private:
}
void _erase(Element *p_node) {
Element *rp = ((p_node->left == _data._nil) || (p_node->right == _data._nil)) ? p_node : p_node->_next;
Element *node = (rp->left == _data._nil) ? rp->right : rp->left;
@ -439,7 +414,6 @@ private:
}
if (rp != p_node) {
ERR_FAIL_COND(rp == _data._nil);
rp->left = p_node->left;
@ -469,7 +443,6 @@ private:
}
void _calculate_depth(Element *p_element, int &max_d, int d) const {
if (p_element == _data._nil)
return;
@ -481,7 +454,6 @@ private:
}
void _cleanup_tree(Element *p_element) {
if (p_element == _data._nil)
return;
@ -491,18 +463,15 @@ private:
}
void _copy_from(const Set &p_set) {
clear();
// not the fastest way, but safeset to write.
for (Element *I = p_set.front(); I; I = I->next()) {
insert(I->get());
}
}
public:
const Element *find(const T &p_value) const {
if (!_data._root)
return NULL;
@ -511,7 +480,6 @@ public:
}
Element *find(const T &p_value) {
if (!_data._root)
return NULL;
@ -520,24 +488,20 @@ public:
}
Element *lower_bound(const T &p_value) const {
return _lower_bound(p_value);
}
bool has(const T &p_value) const {
return find(p_value) != NULL;
}
Element *insert(const T &p_value) {
if (!_data._root)
_data._create_root();
return _insert(p_value);
}
void erase(Element *p_element) {
if (!_data._root || !p_element)
return;
@ -547,7 +511,6 @@ public:
}
bool erase(const T &p_value) {
if (!_data._root)
return false;
@ -562,7 +525,6 @@ public:
}
Element *front() const {
if (!_data._root)
return NULL;
@ -577,7 +539,6 @@ public:
}
Element *back() const {
if (!_data._root)
return NULL;
@ -605,7 +566,6 @@ public:
}
void clear() {
if (!_data._root)
return;
@ -616,12 +576,10 @@ public:
}
void operator=(const Set &p_set) {
_copy_from(p_set);
}
Set(const Set &p_set) {
_copy_from(p_set);
}
@ -629,7 +587,6 @@ public:
}
~Set() {
clear();
}
};