Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/stdlib base0 == NULL is allowed when nmemb == 0, in...



details:   https://anonhg.NetBSD.org/src/rev/8b3494106be6
branches:  trunk
changeset: 777793:8b3494106be6
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 04 20:01:45 2012 +0000

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

diffstat:

 lib/libc/stdlib/bsearch.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 4b42529c6901 -r 8b3494106be6 lib/libc/stdlib/bsearch.c
--- a/lib/libc/stdlib/bsearch.c Sun Mar 04 19:52:02 2012 +0000
+++ b/lib/libc/stdlib/bsearch.c Sun Mar 04 20:01:45 2012 +0000
@@ -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 @@
        const void *p;
 
        _DIAGASSERT(key != NULL);
-       _DIAGASSERT(base0 != NULL);
+       _DIAGASSERT(base0 != NULL || nmemb == 0);
        _DIAGASSERT(compar != NULL);
 
        for (lim = nmemb; lim != 0; lim >>= 1) {



Home | Main Index | Thread Index | Old Index