From 5f1c4d8ae807a33ceef342702bfff9a12ee6e251 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 22 Jun 2024 19:16:40 -0400 Subject: Remove redundant conditionals --- src/path.c | 7 +++---- src/tree.c | 2 ++ test/meson.build | 1 - 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/path.c b/src/path.c index c0140e4..404557a 100644 --- a/src/path.c +++ b/src/path.c @@ -356,10 +356,9 @@ zix_path_lexically_normal(ZixAllocator* const allocator, const char* const path) size_t last = r; size_t next = 0; for (size_t i = root_len; i < r;) { - if (last < r && i > 2 && i + 1 <= r && result[i - 2] == sep && - result[i - 1] == '.' && result[i] == '.' && - (!result[i + 1] || is_dir_sep(result[i + 1]))) { - if (i < r && result[i + 1] == sep) { + if (last < r && i > 2U && result[i - 2U] == sep && result[i - 1U] == '.' && + result[i] == '.' && (!result[i + 1U] || is_dir_sep(result[i + 1U]))) { + if (result[i + 1] == sep) { ++i; } diff --git a/src/tree.c b/src/tree.c index 3c705c6..5e3aa61 100644 --- a/src/tree.c +++ b/src/tree.c @@ -507,6 +507,8 @@ zix_tree_remove(ZixTree* t, ZixTreeIter* ti) t->root = replace; } + assert(n->left); + replace->parent = n->parent; replace->left = n->left; n->left->parent = replace; diff --git a/test/meson.build b/test/meson.build index 3028d4c..1857180 100644 --- a/test/meson.build +++ b/test/meson.build @@ -50,7 +50,6 @@ if not meson.is_subproject() and get_option('lint') '--project=' + compdb_path, '--suppress=constParameterCallback', '--suppress=constParameterPointer', - '--suppress=knownConditionTrueFalse', '--suppress=selfAssignment', '--suppress=unreadVariable', '-q', -- cgit v1.2.1