Source-Changes-HG archive

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

[src/trunk]: src/lib/libc/stdlib don't trigger diagassert for a null array wi...



details:   https://anonhg.NetBSD.org/src/rev/1e4534f21b9c
branches:  trunk
changeset: 779408:1e4534f21b9c
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 26 21:47:05 2012 +0000

description:
don't trigger diagassert for a null array with 0 elements or 0 elementsize.

diffstat:

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

diffs (27 lines):

diff -r a49ea4b134ed -r 1e4534f21b9c lib/libc/stdlib/qsort.c
--- a/lib/libc/stdlib/qsort.c   Sat May 26 20:03:34 2012 +0000
+++ b/lib/libc/stdlib/qsort.c   Sat May 26 21:47:05 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qsort.c,v 1.21 2011/05/18 19:36:36 dsl Exp $   */
+/*     $NetBSD: qsort.c,v 1.22 2012/05/26 21:47:05 christos Exp $      */
 
 /*-
  * Copyright (c) 1992, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)qsort.c    8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: qsort.c,v 1.21 2011/05/18 19:36:36 dsl Exp $");
+__RCSID("$NetBSD: qsort.c,v 1.22 2012/05/26 21:47:05 christos Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -105,7 +105,7 @@
        size_t d, r;
        int swaptype, cmp_result;
 
-       _DIAGASSERT(a != NULL);
+       _DIAGASSERT(a != NULL || n == 0 || es == 0);
        _DIAGASSERT(cmp != NULL);
 
 loop:  SWAPINIT(a, es);



Home | Main Index | Thread Index | Old Index