Module Name:    src
Committed By:   christos
Date:           Sun Mar  4 20:01:45 UTC 2012

Modified Files:
        src/lib/libc/stdlib: bsearch.c

Log Message:
base0 == NULL is allowed when nmemb == 0, in fact the nsdispatch code calls
bsearch this way.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libc/stdlib/bsearch.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libc/stdlib/bsearch.c
diff -u src/lib/libc/stdlib/bsearch.c:1.14 src/lib/libc/stdlib/bsearch.c:1.15
--- src/lib/libc/stdlib/bsearch.c:1.14	Sat Nov 27 13:33:54 2010
+++ src/lib/libc/stdlib/bsearch.c	Sun Mar  4 15:01:45 2012
@@ -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 *bas
 	const void *p;
 
 	_DIAGASSERT(key != NULL);
-	_DIAGASSERT(base0 != NULL);
+	_DIAGASSERT(base0 != NULL || nmemb == 0);
 	_DIAGASSERT(compar != NULL);
 
 	for (lim = nmemb; lim != 0; lim >>= 1) {

Reply via email to