diff options
author | David Robillard <d@drobilla.net> | 2022-05-27 12:33:13 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-27 12:54:10 -0400 |
commit | 47a5eceb3b81b8a015fbaa69a02b984f04a9f0dd (patch) | |
tree | b797d52ba17734b9b8132d1d084b4f7d7281be14 /src/symap.c | |
parent | 9a1ff05280a1b18f486d1a564ac3da77741d6bb8 (diff) | |
download | jalv-47a5eceb3b81b8a015fbaa69a02b984f04a9f0dd.tar.gz jalv-47a5eceb3b81b8a015fbaa69a02b984f04a9f0dd.tar.bz2 jalv-47a5eceb3b81b8a015fbaa69a02b984f04a9f0dd.zip |
Avoid "else" after "return"
Diffstat (limited to 'src/symap.c')
-rw-r--r-- | src/symap.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/symap.c b/src/symap.c index 71a46f0..b699269 100644 --- a/src/symap.c +++ b/src/symap.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2014 David Robillard <d@drobilla.net> + Copyright 2011-2022 David Robillard <d@drobilla.net> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -100,7 +100,9 @@ symap_search(const Symap* map, const char* sym, bool* exact) *exact = false; if (map->size == 0) { return 0; // Empty map, insert at 0 - } else if (strcmp(map->symbols[map->index[map->size - 1] - 1], sym) < 0) { + } + + if (strcmp(map->symbols[map->index[map->size - 1] - 1], sym) < 0) { return map->size; // Greater than last element, append } @@ -116,7 +118,9 @@ symap_search(const Symap* map, const char* sym, bool* exact) if (cmp == 0) { *exact = true; return i; - } else if (cmp > 0) { + } + + if (cmp > 0) { if (i == 0) { break; // Avoid underflow } @@ -178,9 +182,12 @@ symap_unmap(Symap* map, uint32_t id) { if (id == 0) { return NULL; - } else if (id <= map->size) { + } + + if (id <= map->size) { return map->symbols[id - 1]; } + return NULL; } |