summaryrefslogtreecommitdiff
path: root/src/stdlib/bsearch.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdlib/bsearch.c')
-rw-r--r--src/stdlib/bsearch.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/stdlib/bsearch.c b/src/stdlib/bsearch.c
index ae60783e..c710406e 100644
--- a/src/stdlib/bsearch.c
+++ b/src/stdlib/bsearch.c
@@ -12,9 +12,14 @@ void * bsearch(const void * key, const void * base, size_t nmemb, size_t size, i
const char *addr = base;
SIGNAL_SAFE(0);
+ ASSERT_NONNULL(key);
+ ASSERT_NONNULL(base);
/* overlap can't be detected because the size of key can't be known */
+ /* TODO: ensure everything is in order to start with */
+
while (ret == NULL) {
+ /* TODO: ensure compar doesn't modify things */
int comp = compar(key, addr + (i * size));
if (comp == 0) {
return (void*)(addr + (i * size));