summaryrefslogtreecommitdiffstats
path: root/zix/strindex.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-12-31 14:56:07 +0100
committerDavid Robillard <d@drobilla.net>2020-12-31 15:21:10 +0100
commit841c766d86dc35ab37c4fef8ec866d06c41bc383 (patch)
tree3959f9290e8b48f801cae52b7397eaa249c6e5cb /zix/strindex.c
parent5ca5c874e2409b32fbdc4b46a1ba3b5a9200542f (diff)
downloadzix-841c766d86dc35ab37c4fef8ec866d06c41bc383.tar.gz
zix-841c766d86dc35ab37c4fef8ec866d06c41bc383.tar.bz2
zix-841c766d86dc35ab37c4fef8ec866d06c41bc383.zip
Avoid "else" after "return"
Diffstat (limited to 'zix/strindex.c')
-rw-r--r--zix/strindex.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/zix/strindex.c b/zix/strindex.c
index cbc218d..2fdd04f 100644
--- a/zix/strindex.c
+++ b/zix/strindex.c
@@ -234,18 +234,20 @@ zix_strindex_find(ZixStrindex* strindex, const char* const str, char** match)
*match = n->children[child_i].first;
assert(!strncmp(*match, orig_p, strlen(orig_p)));
return ZIX_STATUS_SUCCESS;
- } else if (strindex_is_leaf(n)) {
+ }
+
+ if (strindex_is_leaf(n)) {
/* Hit leaf early, no match */
return ZIX_STATUS_NOT_FOUND;
- } else {
- /* Match at this node, continue search downwards (or match) */
- p += label_len;
- n = &n->children[child_i];
- if (label_len >= p_len) {
- assert(strstr(strindex->s, orig_p) != NULL);
- assert(strncmp(orig_p, *match, max_len));
- return ZIX_STATUS_SUCCESS;
- }
+ }
+
+ /* Match at this node, continue search downwards (or match) */
+ p += label_len;
+ n = &n->children[child_i];
+ if (label_len >= p_len) {
+ assert(strstr(strindex->s, orig_p) != NULL);
+ assert(strncmp(orig_p, *match, max_len));
+ return ZIX_STATUS_SUCCESS;
}
} else {