diff options
author | dundargoc <gocdundar@gmail.com> | 2023-12-16 22:14:28 +0100 |
---|---|---|
committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-12-18 16:22:13 +0100 |
commit | 6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6 (patch) | |
tree | 20bfbe8b317fde86121fcf9af10975b2b95e5758 /src/nvim/marktree.c | |
parent | 8c173cec295cf8c78bdbc440dc87f0473560f69a (diff) | |
download | rneovim-6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6.tar.gz rneovim-6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6.tar.bz2 rneovim-6cb78e2d1c4c6c63c628c965076a07ce5f7adbb6.zip |
docs: add style rule regarding initialization
Specifically, specify that each initialization should be done on a
separate line.
Diffstat (limited to 'src/nvim/marktree.c')
-rw-r--r-- | src/nvim/marktree.c | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index fa5e7dcbe2..958970bba1 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -146,7 +146,8 @@ static inline int marktree_getp_aux(const MTNode *x, MTKey k, bool *match) bool dummy_match; bool *m = match ? match : &dummy_match; - int begin = 0, end = x->n; + int begin = 0; + int end = x->n; if (x->n == 0) { *m = false; return -1; @@ -303,7 +304,8 @@ void marktree_put(MarkTree *b, MTKey key, int end_row, int end_col, bool end_rig |(uint16_t)(end_right ? MT_FLAG_RIGHT_GRAVITY : 0)); end_key.pos = (MTPos){ end_row, end_col }; marktree_put_key(b, end_key); - MarkTreeIter itr[1] = { 0 }, end_itr[1] = { 0 }; + MarkTreeIter itr[1] = { 0 }; + MarkTreeIter end_itr[1] = { 0 }; marktree_lookup(b, mt_lookup_key(key), itr); marktree_lookup(b, mt_lookup_key(end_key), end_itr); @@ -684,8 +686,10 @@ uint64_t marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) static void intersect_merge(Intersection *restrict m, Intersection *restrict x, Intersection *restrict y) { - size_t xi = 0, yi = 0; - size_t xn = 0, yn = 0; + size_t xi = 0; + size_t yi = 0; + size_t xn = 0; + size_t yn = 0; while (xi < kv_size(*x) && yi < kv_size(*y)) { if (kv_A(*x, xi) == kv_A(*y, yi)) { // TODO(bfredl): kvi_pushp is actually quite complex, break out kvi_resize() to a function? @@ -717,8 +721,10 @@ static void intersect_merge(Intersection *restrict m, Intersection *restrict x, static void intersect_mov(Intersection *restrict x, Intersection *restrict y, Intersection *restrict w, Intersection *restrict d) { - size_t wi = 0, yi = 0; - size_t wn = 0, yn = 0; + size_t wi = 0; + size_t yi = 0; + size_t wn = 0; + size_t yn = 0; size_t xi = 0; while (wi < kv_size(*w) || xi < kv_size(*x)) { if (wi < kv_size(*w) && (xi >= kv_size(*x) || kv_A(*x, xi) >= kv_A(*w, wi))) { @@ -810,7 +816,8 @@ bool intersect_mov_test(const uint64_t *x, size_t nx, const uint64_t *y, size_t /// intersection: i = x & y static void intersect_common(Intersection *i, Intersection *x, Intersection *y) { - size_t xi = 0, yi = 0; + size_t xi = 0; + size_t yi = 0; while (xi < kv_size(*x) && yi < kv_size(*y)) { if (kv_A(*x, xi) == kv_A(*y, yi)) { kvi_push(*i, kv_A(*x, xi)); @@ -827,7 +834,8 @@ static void intersect_common(Intersection *i, Intersection *x, Intersection *y) // inplace union: x |= y static void intersect_add(Intersection *x, Intersection *y) { - size_t xi = 0, yi = 0; + size_t xi = 0; + size_t yi = 0; while (xi < kv_size(*x) && yi < kv_size(*y)) { if (kv_A(*x, xi) == kv_A(*y, yi)) { xi++; @@ -854,7 +862,8 @@ static void intersect_add(Intersection *x, Intersection *y) // inplace asymmetric difference: x &= ~y static void intersect_sub(Intersection *restrict x, Intersection *restrict y) { - size_t xi = 0, yi = 0; + size_t xi = 0; + size_t yi = 0; size_t xn = 0; while (xi < kv_size(*x) && yi < kv_size(*y)) { if (kv_A(*x, xi) == kv_A(*y, yi)) { @@ -898,7 +907,8 @@ static void bubble_up(MTNode *x) static MTNode *merge_node(MarkTree *b, MTNode *p, int i) { - MTNode *x = p->ptr[i], *y = p->ptr[i + 1]; + MTNode *x = p->ptr[i]; + MTNode *y = p->ptr[i + 1]; Intersection m; kvi_init(m); @@ -975,7 +985,8 @@ void kvi_move(Intersection *dest, Intersection *src) // key inside x, if x is the first leaf) static void pivot_right(MarkTree *b, MTPos p_pos, MTNode *p, const int i) { - MTNode *x = p->ptr[i], *y = p->ptr[i + 1]; + MTNode *x = p->ptr[i]; + MTNode *y = p->ptr[i + 1]; memmove(&y->key[1], y->key, (size_t)y->n * sizeof(MTKey)); if (y->level) { memmove(&y->ptr[1], y->ptr, ((size_t)y->n + 1) * sizeof(MTNode *)); @@ -1040,7 +1051,8 @@ static void pivot_right(MarkTree *b, MTPos p_pos, MTNode *p, const int i) static void pivot_left(MarkTree *b, MTPos p_pos, MTNode *p, int i) { - MTNode *x = p->ptr[i], *y = p->ptr[i + 1]; + MTNode *x = p->ptr[i]; + MTNode *y = p->ptr[i + 1]; // reverse from how we "always" do it. but pivot_left // is just the inverse of pivot_right, so reverse it literally. @@ -1603,7 +1615,8 @@ static void swap_keys(MarkTree *b, MarkTreeIter *itr1, MarkTreeIter *itr2, Damag static int damage_cmp(const void *s1, const void *s2) { - Damage *d1 = (Damage *)s1, *d2 = (Damage *)s2; + Damage *d1 = (Damage *)s1; + Damage *d2 = (Damage *)s2; assert(d1->id != d2->id); return d1->id > d2->id ? 1 : -1; } @@ -1619,7 +1632,8 @@ bool marktree_splice(MarkTree *b, int32_t start_line, int start_col, int old_ext bool same_line = old_extent.row == 0 && new_extent.row == 0; unrelative(start, &old_extent); unrelative(start, &new_extent); - MarkTreeIter itr[1] = { 0 }, enditr[1] = { 0 }; + MarkTreeIter itr[1] = { 0 }; + MarkTreeIter enditr[1] = { 0 }; MTPos oldbase[MT_MAX_DEPTH] = { 0 }; @@ -1824,7 +1838,8 @@ past_continue_same_node: void marktree_move_region(MarkTree *b, int start_row, colnr_T start_col, int extent_row, colnr_T extent_col, int new_row, colnr_T new_col) { - MTPos start = { start_row, start_col }, size = { extent_row, extent_col }; + MTPos start = { start_row, start_col }; + MTPos size = { extent_row, extent_col }; MTPos end = size; unrelative(start, &end); MarkTreeIter itr[1] = { 0 }; |