summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--NEWS5
-rw-r--r--stdlib/Makefile10
-rw-r--r--stdlib/tst-qsort.c42
4 files changed, 54 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 9875e70e63..83c5ece932 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2002-01-29 Ulrich Drepper <drepper@redhat.com>
+ * stdlib/Makefile (tests): Add tst-qsort.
+ * stdlib/tst-qsort.c: New file. Written by Paul Eggert.
+
* manual/signal.texi (Process Signal Mask): Document that
pthread_sigmask, not sigprocmask, must be used in MT programs.
Patch by Bertold Kolics <Bertold.Kolics@Sun.COM>.
diff --git a/NEWS b/NEWS
index 6496c8b513..7560820180 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-GNU C Library NEWS -- history of user-visible changes. 2002-1-7
+GNU C Library NEWS -- history of user-visible changes. 2002-1-28
Copyright (C) 1992-2000, 2001, 2002 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -21,6 +21,9 @@ Version 2.3
* Read-only stdio streams now use mmap to speed up operation but eliminating
copying and buffer underflows. Implemented by Ulrich Drepper.
+
+* The malloc functions were completely rewritten by Wolfram Gloger based
+ on Doug Lea's malloc-2.7.0.c.
Version 2.2.5
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 5c91f26d36..bfb8e1f78c 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -1,4 +1,4 @@
-# Copyright (C) 1991-1999, 2000, 2001 Free Software Foundation, Inc.
+# Copyright (C) 1991-1999, 2000, 2001, 2002 Free Software Foundation, Inc.
# This file is part of the GNU C Library.
# The GNU C Library is free software; you can redistribute it and/or
@@ -56,10 +56,10 @@ static-only-routines = atexit
distribute := exit.h grouping.h abort-instr.h isomac.c tst-fmtmsg.sh
test-srcs := tst-fmtmsg
-tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
- test-canon test-canon2 tst-strtoll tst-environ \
- tst-xpg-basename tst-random tst-bsearch tst-limits \
- tst-rand48 bug-strtod tst-setcontext test-a64l
+tests := tst-strtol tst-strtod testmb testrand testsort testdiv \
+ test-canon test-canon2 tst-strtoll tst-environ \
+ tst-xpg-basename tst-random tst-bsearch tst-limits \
+ tst-rand48 bug-strtod tst-setcontext test-a64l tst-qsort
# Several mpn functions from GNU MP are used by the strtod function.
diff --git a/stdlib/tst-qsort.c b/stdlib/tst-qsort.c
new file mode 100644
index 0000000000..f39667b17c
--- /dev/null
+++ b/stdlib/tst-qsort.c
@@ -0,0 +1,42 @@
+/* Test case by Paul Eggert <eggert@twinsun.com> */
+#include <stdio.h>
+#include <stdlib.h>
+
+struct big { char c[4 * 1024]; };
+
+struct big *array;
+struct big *array_end;
+
+int
+compare (void const *a1, void const *b1)
+{
+ struct big const *a = a1;
+ struct big const *b = b1;
+ if (! (array <= a && a < array_end
+ && array <= b && b < array_end))
+ {
+ exit (EXIT_FAILURE);
+ }
+ return b->c[0] - a->c[0];
+}
+
+int
+main (int argc, char **argv)
+{
+ size_t i;
+ size_t array_members = argv[1] ? atoi (argv[1]) : 50;
+ array = (struct big *) malloc (array_members * sizeof *array);
+ if (array == NULL)
+ {
+ puts ("no memory");
+ exit (EXIT_FAILURE);
+ }
+
+ array_end = array + array_members;
+ for (i = 0; i < array_members; i++)
+ array[i].c[0] = i % 128;
+
+ qsort (array, array_members, sizeof *array, compare);
+
+ return 0;
+}