diff options
-rw-r--r-- | .suppress.cppcheck | 2 | ||||
-rw-r--r-- | src/symap.c | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/.suppress.cppcheck b/.suppress.cppcheck index cf2c1b7..32d4cd6 100644 --- a/.suppress.cppcheck +++ b/.suppress.cppcheck @@ -7,6 +7,4 @@ knownConditionTrueFalse memleakOnRealloc normalCheckLevelMaxBranches uninitvar -unreadVariable unusedStructMember -variableScope diff --git a/src/symap.c b/src/symap.c index 07002f2..f75da3b 100644 --- a/src/symap.c +++ b/src/symap.c @@ -88,12 +88,11 @@ symap_search(const Symap* const map, const char* const sym, bool* const exact) uint32_t lower = 0; uint32_t upper = map->size - 1; uint32_t i = upper; - int cmp = 0; while (upper >= lower) { - i = lower + ((upper - lower) / 2); - cmp = strcmp(map->symbols[map->index[i] - 1], sym); + i = lower + ((upper - lower) / 2); + const int cmp = strcmp(map->symbols[map->index[i] - 1], sym); if (cmp == 0) { *exact = true; return i; |