summaryrefslogtreecommitdiff
path: root/libc/misc/search/tsearch.c
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2006-01-23 19:12:45 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2006-01-23 19:12:45 +0000
commit8688aa5fed5bf7553ddf8d102290966f32cca982 (patch)
treed4ed1c021a72343834d5f9d8711e90d577b199e7 /libc/misc/search/tsearch.c
parentcf4d1f62f958e84763d057fdcccaeb53ac59fa55 (diff)
Reorganize a bit and mark tdestroy as GNU extension
Diffstat (limited to 'libc/misc/search/tsearch.c')
-rw-r--r--libc/misc/search/tsearch.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c
index 01ecb288b..989710e08 100644
--- a/libc/misc/search/tsearch.c
+++ b/libc/misc/search/tsearch.c
@@ -31,10 +31,6 @@ Cambridge, MA 02139, USA. */
#include <search.h>
#include <stdlib.h>
-libc_hidden_proto(tsearch)
-libc_hidden_proto(tfind)
-libc_hidden_proto(tdestroy)
-
/* This routine is not very bad. It makes many assumptions about
* the compiler. It assumpts that the first field in node must be
* the "key" field, which points to the datum. It is a very trick
@@ -54,6 +50,7 @@ register node **rootp; address of tree root
int (*compar)(); ordering function
*/
+libc_hidden_proto(tsearch)
void *tsearch(__const void *key, void **vrootp, __compar_fn_t compar)
{
register node *q;
@@ -84,6 +81,7 @@ libc_hidden_def(tsearch)
#endif
#ifdef L_tfind
+libc_hidden_proto(tfind)
void *tfind(__const void *key, void * __const *vrootp, __compar_fn_t compar)
{
register node **rootp = (node **) vrootp;
@@ -193,6 +191,7 @@ void twalk(__const void *vroot, __action_fn_t action)
}
#endif
+#ifdef __USE_GNU
#ifdef L_tdestroy
/* The standardized functions miss an important functionality: the
tree cannot be removed easily. We provide a function to do this. */
@@ -209,6 +208,7 @@ tdestroy_recurse (node *root, __free_fn_t freefct)
free (root);
}
+libc_hidden_proto(tdestroy)
void tdestroy (void *vroot, __free_fn_t freefct)
{
node *root = (node *) vroot;
@@ -218,5 +218,6 @@ void tdestroy (void *vroot, __free_fn_t freefct)
}
libc_hidden_def(tdestroy)
#endif
+#endif
/* tsearch.c ends here */