array: fix search for empty arrays When the array is empty `cmp` never gets set by the comparison function. Initialize it so we return ENOTFOUND in those cases.
diff --git a/src/array.h b/src/array.h
index 490e6be..78d321e 100644
--- a/src/array.h
+++ b/src/array.h
@@ -96,7 +96,7 @@ GIT_INLINE(int) git_array__search(
{
size_t lim;
unsigned char *part, *array = array_ptr, *base = array_ptr;
- int cmp;
+ int cmp = -1;
for (lim = array_len; lim != 0; lim >>= 1) {
part = base + (lim >> 1) * item_size;