1997-03-29 18:32:35 +01:00
|
|
|
/* Test program for tsearch et al.
|
2001-06-05 15:38:39 +02:00
|
|
|
Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc.
|
1997-03-29 18:32:35 +01:00
|
|
|
This file is part of the GNU C Library.
|
|
|
|
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 06:58:11 +02:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1997-03-29 18:32:35 +01:00
|
|
|
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 06:58:11 +02:00
|
|
|
Lesser General Public License for more details.
|
1997-03-29 18:32:35 +01:00
|
|
|
|
2001-07-06 06:58:11 +02:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
1997-03-29 18:32:35 +01:00
|
|
|
|
1997-04-09 01:42:08 +02:00
|
|
|
#ifndef _GNU_SOURCE
|
|
|
|
# define _GNU_SOURCE 1
|
|
|
|
#endif
|
1997-03-29 18:32:35 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
1997-04-09 01:42:08 +02:00
|
|
|
#include <string.h>
|
1997-03-29 18:32:35 +01:00
|
|
|
#include <search.h>
|
|
|
|
|
|
|
|
#define SEED 0
|
|
|
|
#define BALANCED 1
|
|
|
|
#define PASSES 100
|
|
|
|
|
|
|
|
#if BALANCED
|
|
|
|
#include <math.h>
|
|
|
|
#define SIZE 1000
|
|
|
|
#else
|
|
|
|
#define SIZE 100
|
|
|
|
#endif
|
|
|
|
|
|
|
|
enum order
|
|
|
|
{
|
|
|
|
ascending,
|
|
|
|
descending,
|
|
|
|
randomorder
|
|
|
|
};
|
|
|
|
|
|
|
|
enum action
|
|
|
|
{
|
|
|
|
build,
|
|
|
|
build_and_del,
|
|
|
|
delete,
|
|
|
|
find
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Set to 1 if a test is flunked. */
|
|
|
|
static int error = 0;
|
|
|
|
|
|
|
|
/* The keys we add to the tree. */
|
|
|
|
static int x[SIZE];
|
|
|
|
|
|
|
|
/* Pointers into the key array, possibly permutated, to define an order
|
|
|
|
for insertion/removal. */
|
|
|
|
static int y[SIZE];
|
|
|
|
|
|
|
|
/* Flags set for each element visited during a tree walk. */
|
|
|
|
static int z[SIZE];
|
|
|
|
|
|
|
|
/* Depths for all the elements, to check that the depth is constant for
|
|
|
|
all three visits. */
|
|
|
|
static int depths[SIZE];
|
|
|
|
|
|
|
|
/* Maximum depth during a tree walk. */
|
|
|
|
static int max_depth;
|
|
|
|
|
|
|
|
/* Compare two keys. */
|
|
|
|
static int
|
|
|
|
cmp_fn (const void *a, const void *b)
|
|
|
|
{
|
|
|
|
return *(const int *) a - *(const int *) b;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Permute an array of integers. */
|
|
|
|
static void
|
|
|
|
memfry (int *string)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < SIZE; ++i)
|
|
|
|
{
|
|
|
|
int32_t j;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
j = random () % SIZE;
|
|
|
|
|
|
|
|
c = string[i];
|
|
|
|
string[i] = string[j];
|
|
|
|
string[j] = c;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
walk_action (const void *nodep, const VISIT which, const int depth)
|
|
|
|
{
|
|
|
|
int key = **(int **) nodep;
|
|
|
|
|
|
|
|
if (depth > max_depth)
|
|
|
|
max_depth = depth;
|
|
|
|
if (which == leaf || which == preorder)
|
|
|
|
{
|
|
|
|
++z[key];
|
|
|
|
depths[key] = depth;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (depths[key] != depth)
|
|
|
|
{
|
|
|
|
fputs ("Depth for one element is not constant during tree walk.\n",
|
1997-04-01 00:56:24 +02:00
|
|
|
stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
walk_tree (void *root, int expected_count)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
memset (z, 0, sizeof z);
|
|
|
|
max_depth = 0;
|
|
|
|
|
|
|
|
twalk (root, walk_action);
|
|
|
|
for (i = 0; i < expected_count; ++i)
|
|
|
|
if (z[i] != 1)
|
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Node was not visited.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if BALANCED
|
|
|
|
if (max_depth > log (expected_count) * 2 + 2)
|
|
|
|
#else
|
|
|
|
if (max_depth > expected_count)
|
|
|
|
#endif
|
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Depth too large during tree walk.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Perform an operation on a tree. */
|
|
|
|
static void
|
|
|
|
mangle_tree (enum order how, enum action what, void **root, int lag)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (how == randomorder)
|
|
|
|
{
|
|
|
|
for (i = 0; i < SIZE; ++i)
|
|
|
|
y[i] = i;
|
|
|
|
memfry (y);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < SIZE + lag; ++i)
|
|
|
|
{
|
|
|
|
void *elem;
|
|
|
|
int j, k;
|
|
|
|
|
|
|
|
switch (how)
|
|
|
|
{
|
|
|
|
case randomorder:
|
|
|
|
if (i >= lag)
|
|
|
|
k = y[i - lag];
|
|
|
|
else
|
2001-06-05 15:38:39 +02:00
|
|
|
/* Ensure that the array index is within bounds. */
|
|
|
|
k = y[(SIZE - i - 1 + lag) % SIZE];
|
|
|
|
j = y[i % SIZE];
|
1997-03-29 18:32:35 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ascending:
|
|
|
|
k = i - lag;
|
|
|
|
j = i;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case descending:
|
|
|
|
k = SIZE - i - 1 + lag;
|
|
|
|
j = SIZE - i - 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* This never should happen, but gcc isn't smart enough to
|
|
|
|
recognize it. */
|
|
|
|
abort ();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (what)
|
|
|
|
{
|
|
|
|
case build_and_del:
|
|
|
|
case build:
|
|
|
|
if (i < SIZE)
|
|
|
|
{
|
Update.
1997-05-31 02:33 Ulrich Drepper <drepper@cygnus.com>
* io/ftwtest-sh: More tests.
* misc/tsearch.c: Rewrite tdestroy_recursive.
* libio/libio.h: Define bits for libg++-2.8.
1997-05-30 22:21 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nis/nis-hosts.c: Same changes as in
nss/nss_files/files-hosts.c (Always use inet_pton).
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
1997-05-30 09:50 Richard Henderson <rth@tamu.edu>
* manual/maint.texi: ECOFF hasn't been tested in ages and I don't
plan on doing so ever again. Don't say alpha-linuxecoff is known
to work.
* elf/dl-lookup.c: Include <alloca.h>.
* misc/tsearch.c: Include <string.h>.
* posix/execle.c: Include <alloca.h>.
* posix/execlp.c: Likewise.
* stdio-common/printf_fphex.c: Include <string.h>.
* sunrpc/xdr.c: Include <string.h>.
* sysdeps/generic/memccpy.c: Include only <string.h>.
* sunrpc/clnt_udp.c (clntudp_call): Make fromlen a size_t to fix
parameters to network functions.
* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
* sunrpc/svc_tcp.c (svctcp_create): Likewise with `len'.
(rendezvous_request): Likewise.
* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
(svcudp_recv): Similar, but go through a local variable. The old code
used &xprt->xp_addrlen. Someone should determine if the type of the
structure member should be changed instead.
* sunrpc/xdr_rec.c (xdrrec_create): Expunge a ptr->int cast warning
and transform a nonsense for-loop to a closed form calculation.
(fill_input_buf): Another ptr->int warning.
* sysdeps/alpha/Makefile: Temporarily turn on -mieee globally. This
will last until I figure out how to build a parallel libm_ieee.
* sysdeps/alpha/fpu/fclrexcpt.c,
* sysdeps/alpha/fpu/fegetenv.c,
* sysdeps/alpha/fpu/fegetround.c,
* sysdeps/alpha/fpu/feholdexcpt.c,
* sysdeps/alpha/fpu/fenvbits.h,
* sysdeps/alpha/fpu/fesetenv.c,
* sysdeps/alpha/fpu/fesetround.c,
* sysdeps/alpha/fpu/feupdateenv.c,
* sysdeps/alpha/fpu/fgetexcptflg.c,
* sysdeps/alpha/fpu/fraiseexcpt.c,
* sysdeps/alpha/fpu/fsetexcptflg.c,
* sysdeps/alpha/fpu/ftestexcept.c: New files. There is, btw, a small
kernel patch that must be applied as of 2.0.31-pre1 and 2.1.41 for
this to work properly.
* sysdeps/alpha/fpu/fpu_control.h: Update copyright. Change default
FP mode to round to nearest, no exceptions as for Intel.
* sysdeps/unix/sysv/linux/alpha/setfpucw.c: Add copyright.
(rdfpcr): Use excb rather than trapb. Be more efficient about
getting at the fpcr.
(wrfpcr): Likewise.
(__setfpucw): Reformat.
* sysdeps/ieee754/huge_val.h: Change GCC's HUGE_VAL definition to use
a single DI-mode integer instead of bytes. This produces better code
on Alpha. Similar for HUGE_VALF.
* sysdeps/ieee754/nan.h: Similar for NAN. Add NANF and NANL.
* sysdeps/libm-ieee754/s_log2.c: Missing */ and weak_alias.
* sysdeps/unix/alpha/sysdep.S: Tiny cleanups.
* sysdeps/unix/sysv/linux/alpha/syscall.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/brk.S: Don't use jmp macro to make
sure the stack frame is released the very instruction before the
real jump out.
* sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/gnu/types.h: Undef some bits we may
have gotten from <linux/posix_types.h>.
* sysdeps/unix/sysv/linux/alpha/ioperm.c: Add definition for Miata.
1997-05-30 13:05 Ulrich Drepper <drepper@cygnus.com>
* misc/tst-tsearch.c (mangle_tree): Update casts to prevent
warnings.
1997-05-29 14:02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/ttydefaults.h (CEOL, CSTATUS): Use
correct value for _POSIX_VDISABLE.
1997-05-29 13:59 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (manual/dir-add.texi): Force execution.
1997-05-29 13:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysexits.h: New file.
1997-05-29 13:55 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/strfmon.c: Don't run past EOS after `='.
1997-02-27 10:34 Richard Henderson <rth@tamu.edu>
1997-05-31 02:47:04 +02:00
|
|
|
if (tfind (x + j, (void *const *) root, cmp_fn) != NULL)
|
1997-03-29 18:32:35 +01:00
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Found element which is not in tree yet.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
elem = tsearch (x + j, root, cmp_fn);
|
|
|
|
if (elem == 0
|
Update.
1997-05-31 02:33 Ulrich Drepper <drepper@cygnus.com>
* io/ftwtest-sh: More tests.
* misc/tsearch.c: Rewrite tdestroy_recursive.
* libio/libio.h: Define bits for libg++-2.8.
1997-05-30 22:21 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nis/nis-hosts.c: Same changes as in
nss/nss_files/files-hosts.c (Always use inet_pton).
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
1997-05-30 09:50 Richard Henderson <rth@tamu.edu>
* manual/maint.texi: ECOFF hasn't been tested in ages and I don't
plan on doing so ever again. Don't say alpha-linuxecoff is known
to work.
* elf/dl-lookup.c: Include <alloca.h>.
* misc/tsearch.c: Include <string.h>.
* posix/execle.c: Include <alloca.h>.
* posix/execlp.c: Likewise.
* stdio-common/printf_fphex.c: Include <string.h>.
* sunrpc/xdr.c: Include <string.h>.
* sysdeps/generic/memccpy.c: Include only <string.h>.
* sunrpc/clnt_udp.c (clntudp_call): Make fromlen a size_t to fix
parameters to network functions.
* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
* sunrpc/svc_tcp.c (svctcp_create): Likewise with `len'.
(rendezvous_request): Likewise.
* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
(svcudp_recv): Similar, but go through a local variable. The old code
used &xprt->xp_addrlen. Someone should determine if the type of the
structure member should be changed instead.
* sunrpc/xdr_rec.c (xdrrec_create): Expunge a ptr->int cast warning
and transform a nonsense for-loop to a closed form calculation.
(fill_input_buf): Another ptr->int warning.
* sysdeps/alpha/Makefile: Temporarily turn on -mieee globally. This
will last until I figure out how to build a parallel libm_ieee.
* sysdeps/alpha/fpu/fclrexcpt.c,
* sysdeps/alpha/fpu/fegetenv.c,
* sysdeps/alpha/fpu/fegetround.c,
* sysdeps/alpha/fpu/feholdexcpt.c,
* sysdeps/alpha/fpu/fenvbits.h,
* sysdeps/alpha/fpu/fesetenv.c,
* sysdeps/alpha/fpu/fesetround.c,
* sysdeps/alpha/fpu/feupdateenv.c,
* sysdeps/alpha/fpu/fgetexcptflg.c,
* sysdeps/alpha/fpu/fraiseexcpt.c,
* sysdeps/alpha/fpu/fsetexcptflg.c,
* sysdeps/alpha/fpu/ftestexcept.c: New files. There is, btw, a small
kernel patch that must be applied as of 2.0.31-pre1 and 2.1.41 for
this to work properly.
* sysdeps/alpha/fpu/fpu_control.h: Update copyright. Change default
FP mode to round to nearest, no exceptions as for Intel.
* sysdeps/unix/sysv/linux/alpha/setfpucw.c: Add copyright.
(rdfpcr): Use excb rather than trapb. Be more efficient about
getting at the fpcr.
(wrfpcr): Likewise.
(__setfpucw): Reformat.
* sysdeps/ieee754/huge_val.h: Change GCC's HUGE_VAL definition to use
a single DI-mode integer instead of bytes. This produces better code
on Alpha. Similar for HUGE_VALF.
* sysdeps/ieee754/nan.h: Similar for NAN. Add NANF and NANL.
* sysdeps/libm-ieee754/s_log2.c: Missing */ and weak_alias.
* sysdeps/unix/alpha/sysdep.S: Tiny cleanups.
* sysdeps/unix/sysv/linux/alpha/syscall.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/brk.S: Don't use jmp macro to make
sure the stack frame is released the very instruction before the
real jump out.
* sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/gnu/types.h: Undef some bits we may
have gotten from <linux/posix_types.h>.
* sysdeps/unix/sysv/linux/alpha/ioperm.c: Add definition for Miata.
1997-05-30 13:05 Ulrich Drepper <drepper@cygnus.com>
* misc/tst-tsearch.c (mangle_tree): Update casts to prevent
warnings.
1997-05-29 14:02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/ttydefaults.h (CEOL, CSTATUS): Use
correct value for _POSIX_VDISABLE.
1997-05-29 13:59 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (manual/dir-add.texi): Force execution.
1997-05-29 13:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysexits.h: New file.
1997-05-29 13:55 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/strfmon.c: Don't run past EOS after `='.
1997-02-27 10:34 Richard Henderson <rth@tamu.edu>
1997-05-31 02:47:04 +02:00
|
|
|
|| tfind (x + j, (void *const *) root, cmp_fn) == NULL)
|
1997-03-29 18:32:35 +01:00
|
|
|
{
|
|
|
|
fputs ("Couldn't find element after it was added.\n",
|
1997-04-01 00:56:24 +02:00
|
|
|
stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (what == build || i < lag)
|
|
|
|
break;
|
|
|
|
|
|
|
|
j = k;
|
|
|
|
/* fall through */
|
|
|
|
|
|
|
|
case delete:
|
Update.
1997-05-31 02:33 Ulrich Drepper <drepper@cygnus.com>
* io/ftwtest-sh: More tests.
* misc/tsearch.c: Rewrite tdestroy_recursive.
* libio/libio.h: Define bits for libg++-2.8.
1997-05-30 22:21 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nis/nis-hosts.c: Same changes as in
nss/nss_files/files-hosts.c (Always use inet_pton).
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
1997-05-30 09:50 Richard Henderson <rth@tamu.edu>
* manual/maint.texi: ECOFF hasn't been tested in ages and I don't
plan on doing so ever again. Don't say alpha-linuxecoff is known
to work.
* elf/dl-lookup.c: Include <alloca.h>.
* misc/tsearch.c: Include <string.h>.
* posix/execle.c: Include <alloca.h>.
* posix/execlp.c: Likewise.
* stdio-common/printf_fphex.c: Include <string.h>.
* sunrpc/xdr.c: Include <string.h>.
* sysdeps/generic/memccpy.c: Include only <string.h>.
* sunrpc/clnt_udp.c (clntudp_call): Make fromlen a size_t to fix
parameters to network functions.
* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
* sunrpc/svc_tcp.c (svctcp_create): Likewise with `len'.
(rendezvous_request): Likewise.
* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
(svcudp_recv): Similar, but go through a local variable. The old code
used &xprt->xp_addrlen. Someone should determine if the type of the
structure member should be changed instead.
* sunrpc/xdr_rec.c (xdrrec_create): Expunge a ptr->int cast warning
and transform a nonsense for-loop to a closed form calculation.
(fill_input_buf): Another ptr->int warning.
* sysdeps/alpha/Makefile: Temporarily turn on -mieee globally. This
will last until I figure out how to build a parallel libm_ieee.
* sysdeps/alpha/fpu/fclrexcpt.c,
* sysdeps/alpha/fpu/fegetenv.c,
* sysdeps/alpha/fpu/fegetround.c,
* sysdeps/alpha/fpu/feholdexcpt.c,
* sysdeps/alpha/fpu/fenvbits.h,
* sysdeps/alpha/fpu/fesetenv.c,
* sysdeps/alpha/fpu/fesetround.c,
* sysdeps/alpha/fpu/feupdateenv.c,
* sysdeps/alpha/fpu/fgetexcptflg.c,
* sysdeps/alpha/fpu/fraiseexcpt.c,
* sysdeps/alpha/fpu/fsetexcptflg.c,
* sysdeps/alpha/fpu/ftestexcept.c: New files. There is, btw, a small
kernel patch that must be applied as of 2.0.31-pre1 and 2.1.41 for
this to work properly.
* sysdeps/alpha/fpu/fpu_control.h: Update copyright. Change default
FP mode to round to nearest, no exceptions as for Intel.
* sysdeps/unix/sysv/linux/alpha/setfpucw.c: Add copyright.
(rdfpcr): Use excb rather than trapb. Be more efficient about
getting at the fpcr.
(wrfpcr): Likewise.
(__setfpucw): Reformat.
* sysdeps/ieee754/huge_val.h: Change GCC's HUGE_VAL definition to use
a single DI-mode integer instead of bytes. This produces better code
on Alpha. Similar for HUGE_VALF.
* sysdeps/ieee754/nan.h: Similar for NAN. Add NANF and NANL.
* sysdeps/libm-ieee754/s_log2.c: Missing */ and weak_alias.
* sysdeps/unix/alpha/sysdep.S: Tiny cleanups.
* sysdeps/unix/sysv/linux/alpha/syscall.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/brk.S: Don't use jmp macro to make
sure the stack frame is released the very instruction before the
real jump out.
* sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/gnu/types.h: Undef some bits we may
have gotten from <linux/posix_types.h>.
* sysdeps/unix/sysv/linux/alpha/ioperm.c: Add definition for Miata.
1997-05-30 13:05 Ulrich Drepper <drepper@cygnus.com>
* misc/tst-tsearch.c (mangle_tree): Update casts to prevent
warnings.
1997-05-29 14:02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/ttydefaults.h (CEOL, CSTATUS): Use
correct value for _POSIX_VDISABLE.
1997-05-29 13:59 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (manual/dir-add.texi): Force execution.
1997-05-29 13:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysexits.h: New file.
1997-05-29 13:55 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/strfmon.c: Don't run past EOS after `='.
1997-02-27 10:34 Richard Henderson <rth@tamu.edu>
1997-05-31 02:47:04 +02:00
|
|
|
elem = tfind (x + j, (void *const *) root, cmp_fn);
|
1997-03-29 18:32:35 +01:00
|
|
|
if (elem == NULL || tdelete (x + j, root, cmp_fn) == NULL)
|
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Error deleting element.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case find:
|
Update.
1997-05-31 02:33 Ulrich Drepper <drepper@cygnus.com>
* io/ftwtest-sh: More tests.
* misc/tsearch.c: Rewrite tdestroy_recursive.
* libio/libio.h: Define bits for libg++-2.8.
1997-05-30 22:21 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/nss_nis/nis-hosts.c: Same changes as in
nss/nss_files/files-hosts.c (Always use inet_pton).
* nis/nss_nisplus/nisplus-hosts.c: Likewise.
1997-05-30 09:50 Richard Henderson <rth@tamu.edu>
* manual/maint.texi: ECOFF hasn't been tested in ages and I don't
plan on doing so ever again. Don't say alpha-linuxecoff is known
to work.
* elf/dl-lookup.c: Include <alloca.h>.
* misc/tsearch.c: Include <string.h>.
* posix/execle.c: Include <alloca.h>.
* posix/execlp.c: Likewise.
* stdio-common/printf_fphex.c: Include <string.h>.
* sunrpc/xdr.c: Include <string.h>.
* sysdeps/generic/memccpy.c: Include only <string.h>.
* sunrpc/clnt_udp.c (clntudp_call): Make fromlen a size_t to fix
parameters to network functions.
* sunrpc/pmap_rmt.c (clnt_broadcast): Likewise.
* sunrpc/svc_tcp.c (svctcp_create): Likewise with `len'.
(rendezvous_request): Likewise.
* sunrpc/svc_udp.c (svcudp_bufcreate): Likewise.
(svcudp_recv): Similar, but go through a local variable. The old code
used &xprt->xp_addrlen. Someone should determine if the type of the
structure member should be changed instead.
* sunrpc/xdr_rec.c (xdrrec_create): Expunge a ptr->int cast warning
and transform a nonsense for-loop to a closed form calculation.
(fill_input_buf): Another ptr->int warning.
* sysdeps/alpha/Makefile: Temporarily turn on -mieee globally. This
will last until I figure out how to build a parallel libm_ieee.
* sysdeps/alpha/fpu/fclrexcpt.c,
* sysdeps/alpha/fpu/fegetenv.c,
* sysdeps/alpha/fpu/fegetround.c,
* sysdeps/alpha/fpu/feholdexcpt.c,
* sysdeps/alpha/fpu/fenvbits.h,
* sysdeps/alpha/fpu/fesetenv.c,
* sysdeps/alpha/fpu/fesetround.c,
* sysdeps/alpha/fpu/feupdateenv.c,
* sysdeps/alpha/fpu/fgetexcptflg.c,
* sysdeps/alpha/fpu/fraiseexcpt.c,
* sysdeps/alpha/fpu/fsetexcptflg.c,
* sysdeps/alpha/fpu/ftestexcept.c: New files. There is, btw, a small
kernel patch that must be applied as of 2.0.31-pre1 and 2.1.41 for
this to work properly.
* sysdeps/alpha/fpu/fpu_control.h: Update copyright. Change default
FP mode to round to nearest, no exceptions as for Intel.
* sysdeps/unix/sysv/linux/alpha/setfpucw.c: Add copyright.
(rdfpcr): Use excb rather than trapb. Be more efficient about
getting at the fpcr.
(wrfpcr): Likewise.
(__setfpucw): Reformat.
* sysdeps/ieee754/huge_val.h: Change GCC's HUGE_VAL definition to use
a single DI-mode integer instead of bytes. This produces better code
on Alpha. Similar for HUGE_VALF.
* sysdeps/ieee754/nan.h: Similar for NAN. Add NANF and NANL.
* sysdeps/libm-ieee754/s_log2.c: Missing */ and weak_alias.
* sysdeps/unix/alpha/sysdep.S: Tiny cleanups.
* sysdeps/unix/sysv/linux/alpha/syscall.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/brk.S: Don't use jmp macro to make
sure the stack frame is released the very instruction before the
real jump out.
* sysdeps/unix/sysv/linux/alpha/ieee_get_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/ieee_set_fp_control.S: Likewise.
* sysdeps/unix/sysv/linux/alpha/gnu/types.h: Undef some bits we may
have gotten from <linux/posix_types.h>.
* sysdeps/unix/sysv/linux/alpha/ioperm.c: Add definition for Miata.
1997-05-30 13:05 Ulrich Drepper <drepper@cygnus.com>
* misc/tst-tsearch.c (mangle_tree): Update casts to prevent
warnings.
1997-05-29 14:02 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/unix/sysv/linux/sys/ttydefaults.h (CEOL, CSTATUS): Use
correct value for _POSIX_VDISABLE.
1997-05-29 13:59 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makefile (manual/dir-add.texi): Force execution.
1997-05-29 13:57 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysexits.h: New file.
1997-05-29 13:55 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* stdlib/strfmon.c: Don't run past EOS after `='.
1997-02-27 10:34 Richard Henderson <rth@tamu.edu>
1997-05-31 02:47:04 +02:00
|
|
|
if (tfind (x + j, (void *const *) root, cmp_fn) == NULL)
|
1997-03-29 18:32:35 +01:00
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Couldn't find element after it was added.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
error = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
main (int argc, char **argv)
|
|
|
|
{
|
|
|
|
int total_error = 0;
|
2000-05-05 17:29:58 +02:00
|
|
|
static char state[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
1997-03-29 18:32:35 +01:00
|
|
|
void *root = NULL;
|
|
|
|
int i, j;
|
|
|
|
|
|
|
|
initstate (SEED, state, 8);
|
|
|
|
|
|
|
|
for (i = 0; i < SIZE; ++i)
|
|
|
|
x[i] = i;
|
|
|
|
|
|
|
|
/* Do this loop several times to get different permutations for the
|
|
|
|
random case. */
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Series I\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
for (i = 0; i < PASSES; ++i)
|
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fprintf (stdout, "Pass %d... ", i + 1);
|
1997-03-29 18:32:35 +01:00
|
|
|
fflush (stdout);
|
|
|
|
error = 0;
|
|
|
|
|
|
|
|
mangle_tree (ascending, build, &root, 0);
|
|
|
|
mangle_tree (ascending, find, &root, 0);
|
|
|
|
mangle_tree (descending, find, &root, 0);
|
|
|
|
mangle_tree (randomorder, find, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (ascending, delete, &root, 0);
|
|
|
|
|
|
|
|
mangle_tree (ascending, build, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (descending, delete, &root, 0);
|
|
|
|
|
|
|
|
mangle_tree (ascending, build, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (randomorder, delete, &root, 0);
|
|
|
|
|
|
|
|
mangle_tree (descending, build, &root, 0);
|
|
|
|
mangle_tree (ascending, find, &root, 0);
|
|
|
|
mangle_tree (descending, find, &root, 0);
|
|
|
|
mangle_tree (randomorder, find, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (descending, delete, &root, 0);
|
|
|
|
|
|
|
|
mangle_tree (descending, build, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (descending, delete, &root, 0);
|
|
|
|
|
|
|
|
mangle_tree (descending, build, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (randomorder, delete, &root, 0);
|
|
|
|
|
|
|
|
mangle_tree (randomorder, build, &root, 0);
|
|
|
|
mangle_tree (ascending, find, &root, 0);
|
|
|
|
mangle_tree (descending, find, &root, 0);
|
|
|
|
mangle_tree (randomorder, find, &root, 0);
|
|
|
|
walk_tree (root, SIZE);
|
|
|
|
mangle_tree (randomorder, delete, &root, 0);
|
|
|
|
|
|
|
|
for (j = 1; j < SIZE; j *= 2)
|
|
|
|
{
|
|
|
|
mangle_tree (randomorder, build_and_del, &root, j);
|
|
|
|
}
|
|
|
|
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs (error ? " failed!\n" : " ok.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
total_error |= error;
|
|
|
|
}
|
|
|
|
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs ("Series II\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
for (i = 1; i < SIZE; i *= 2)
|
|
|
|
{
|
1997-04-01 00:56:24 +02:00
|
|
|
fprintf (stdout, "For size %d... ", i);
|
1997-03-29 18:32:35 +01:00
|
|
|
fflush (stdout);
|
|
|
|
error = 0;
|
|
|
|
|
|
|
|
mangle_tree (ascending, build_and_del, &root, i);
|
|
|
|
mangle_tree (descending, build_and_del, &root, i);
|
|
|
|
mangle_tree (ascending, build_and_del, &root, i);
|
|
|
|
mangle_tree (descending, build_and_del, &root, i);
|
|
|
|
mangle_tree (ascending, build_and_del, &root, i);
|
|
|
|
mangle_tree (descending, build_and_del, &root, i);
|
|
|
|
mangle_tree (ascending, build_and_del, &root, i);
|
|
|
|
mangle_tree (descending, build_and_del, &root, i);
|
|
|
|
|
1997-04-01 00:56:24 +02:00
|
|
|
fputs (error ? " failed!\n" : " ok.\n", stdout);
|
1997-03-29 18:32:35 +01:00
|
|
|
total_error |= error;
|
|
|
|
}
|
|
|
|
|
|
|
|
return total_error;
|
|
|
|
}
|