From 143ed959c9a4d591538413b59b935fdba1066a5c Mon Sep 17 00:00:00 2001 From: Daumantas Kavolis Date: Wed, 25 Oct 2023 10:47:55 +0300 Subject: [PATCH] Use single if block --- lib/src/tree_cursor.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/src/tree_cursor.c b/lib/src/tree_cursor.c index f08b9692..63d22c8b 100644 --- a/lib/src/tree_cursor.c +++ b/lib/src/tree_cursor.c @@ -378,14 +378,14 @@ TreeCursorStep ts_tree_cursor_goto_previous_sibling_internal(TSTreeCursor *_self uint32_t child_index = array_back(&self->stack)->child_index; const Subtree *children = ts_subtree_children((*(parent->subtree))); - // skip first child padding since its position should match the position of the parent - if (child_index > 0) + if (child_index > 0) { + // skip first child padding since its position should match the position of the parent position = length_add(position, ts_subtree_size(children[0])); - for (uint32_t i = 1; i < child_index; ++i) { - position = length_add(position, ts_subtree_total_size(children[i])); - } - if (child_index > 0) + for (uint32_t i = 1; i < child_index; ++i) { + position = length_add(position, ts_subtree_total_size(children[i])); + } position = length_add(position, ts_subtree_padding(children[child_index])); + } array_back(&self->stack)->position = position;