summaryrefslogtreecommitdiff
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2012-03-04 20:01:45 +0000
committerchristos <christos@NetBSD.org>2012-03-04 20:01:45 +0000
commit3af4c3569be9e51d8825afd4b77e35eb7cdca147 (patch)
treebdf9c2f636bc1518b260fc126f10b47da712d36d /lib/libc/stdlib
parent54d840facb523f590bf6f71ade9908f9dabbc177 (diff)
base0 == NULL is allowed when nmemb == 0, in fact the nsdispatch code calls
bsearch this way.
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/bsearch.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/stdlib/bsearch.c b/lib/libc/stdlib/bsearch.c
index a8ab2994e7d..2b0e0d86f1e 100644
--- a/lib/libc/stdlib/bsearch.c
+++ b/lib/libc/stdlib/bsearch.c
@@ -1,4 +1,4 @@
-/* $NetBSD: bsearch.c,v 1.14 2010/11/27 18:33:54 christos Exp $ */
+/* $NetBSD: bsearch.c,v 1.15 2012/03/04 20:01:45 christos Exp $ */
/*
* Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)bsearch.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: bsearch.c,v 1.14 2010/11/27 18:33:54 christos Exp $");
+__RCSID("$NetBSD: bsearch.c,v 1.15 2012/03/04 20:01:45 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -68,7 +68,7 @@ bsearch(const void *key, const void *base0, size_t nmemb, size_t size,
const void *p;
_DIAGASSERT(key != NULL);
- _DIAGASSERT(base0 != NULL);
+ _DIAGASSERT(base0 != NULL || nmemb == 0);
_DIAGASSERT(compar != NULL);
for (lim = nmemb; lim != 0; lim >>= 1) {