diff options
| author | Tyge Løvset <[email protected]> | 2022-08-17 14:21:54 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2022-08-17 14:21:54 +0200 |
| commit | bd85ecdd0ba00c15a2fa093e0896367ac0d48514 (patch) | |
| tree | c784db3564e52951aeb4c3ae898b149462c3b927 | |
| parent | 2f4993a174c943c46d4da989e3c8acee560e1eb7 (diff) | |
| download | STC-modified-bd85ecdd0ba00c15a2fa093e0896367ac0d48514.tar.gz STC-modified-bd85ecdd0ba00c15a2fa093e0896367ac0d48514.zip | |
Fix another potensial iter-bug in cvec binary search.
| -rw-r--r-- | include/stc/cvec.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/stc/cvec.h b/include/stc/cvec.h index 6b120ff0..fcf05c10 100644 --- a/include/stc/cvec.h +++ b/include/stc/cvec.h @@ -411,7 +411,8 @@ _cx_memb(_find_in)(_cx_iter i1, _cx_iter i2, _cx_raw raw) { if (i_eq((&raw), (&r))) return i1; } - i2.ref = NULL; return i2; // NB! + i2.ref = NULL; // NB! + return i2; } STC_DEF _cx_iter @@ -428,8 +429,9 @@ _cx_memb(_binary_search_in)(_cx_iter i1, _cx_iter i2, const _cx_raw raw, else if (c < 0) p2 = mid.ref; else i1.ref = mid.ref + 1; } + i2.ref = NULL; // NB! *lower_bound = i1.ref == i2.end ? i2 : i1; - i2.ref = NULL; return i2; // NB! + return i2; } STC_DEF int |
