[core] array keys are non-empty in key-value list

personal/stbuehler/ci-build
Glenn Strauss 2019-10-06 16:05:00 -04:00
parent db5ff222e4
commit 61785d868f
1 changed files with 5 additions and 1 deletions

View File

@ -133,7 +133,11 @@ static int32_t array_get_index(const array * const a, const char * const k, cons
while (lower != upper) {
uint32_t probe = (lower + upper) / 2;
const buffer * const b = a->data[a->sorted[probe]]->key;
int cmp = array_keycmp(k, klen, CONST_BUF_LEN(b));
/* key is non-empty (0==b->used), though possibly blank (1==b->used),
* if inserted into key-value array */
/*force_assert(b && b->used);*/
int cmp = array_keycmp(k, klen, b->ptr, b->used-1);
/*int cmp = array_keycmp(k, klen, CONST_BUF_LEN(b));*/
if (cmp < 0) /* key < [probe] */
upper = probe; /* still: lower <= upper */
else if (cmp > 0) /* key > [probe] */