From 7d0aacb12427a84c8ae9073710045ce4eec4b0f5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 29 Sep 2024 19:25:00 -0400 Subject: Reduce variable scope --- src/symap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/symap.c') 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; -- cgit v1.2.1