.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
-.TH TSEARCH 3 2012-08-03 "GNU" "Linux Programmer's Manual"
+.TH TSEARCH 3 2014-05-28 "GNU" "Linux Programmer's Manual"
.SH NAME
tsearch, tfind, tdelete, twalk, tdestroy \- manage a binary tree
.SH SYNOPSIS
.BI "void *tsearch(const void *" key ", void **" rootp ,
.BI " int (*" compar ")(const void *, const void *));"
.sp
-.BI "void *tfind(const void *" key ", const void **" rootp ,
+.BI "void *tfind(const void *" key ", void *const *" rootp ,
.BI " int (*" compar ")(const void *, const void *));"
.sp
.BI "void *tdelete(const void *" key ", void **" rootp ,
#include <stdio.h>
#include <time.h>
-void *root = NULL;
+static void *root = NULL;
-void *
+static void *
xmalloc(unsigned n)
{
void *p;
exit(EXIT_FAILURE);
}
-int
+static int
compare(const void *pa, const void *pb)
{
if (*(int *) pa < *(int *) pb)
return 0;
}
-void
+static void
action(const void *nodep, const VISIT which, const int depth)
{
int *datap;
.BR hsearch (3),
.BR lsearch (3),
.BR qsort (3)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.