Commit 1a2d8bd3 by Carlos Martín Nieto

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.
parent 661db4f4
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment