if (keys->count == keys->last_id - keys->first_id + 1)
return FALSE;
/* Worst case, look for the spot from the beginning. */
for (i = 0, *id = keys->first_id; i < keys->count; i++, ++*id)
{
if (*id != keys->keys[i].id)
break;
}
Does that work? The keys aren't necessarily ordered by ID, right?
Regardless, it may be easier to make use of the fact that we never
shrink the keys array.