summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib/twalk.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdlib/twalk.c')
-rw-r--r--lib/libc/stdlib/twalk.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/libc/stdlib/twalk.c b/lib/libc/stdlib/twalk.c
index 55f220f3..7acee41 100644
--- a/lib/libc/stdlib/twalk.c
+++ b/lib/libc/stdlib/twalk.c
@@ -1,4 +1,4 @@
-/* $NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $ */
+/* $NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $ */
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
@@ -14,7 +14,7 @@
#include <sys/cdefs.h>
#if 0
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: twalk.c,v 1.1 1999/02/22 10:33:16 christos Exp $");
+__RCSID("$NetBSD: twalk.c,v 1.4 2012/03/20 16:38:45 matt Exp $");
#endif /* LIBC_SCCS and not lint */
#endif
__FBSDID("$FreeBSD$");
@@ -23,15 +23,12 @@ __FBSDID("$FreeBSD$");
#include <search.h>
#include <stdlib.h>
-static void trecurse(const node_t *,
- void (*action)(const void *, VISIT, int), int level);
+typedef void (*cmp_fn_t)(const void *, VISIT, int);
/* Walk the nodes of a tree */
static void
-trecurse(root, action, level)
- const node_t *root; /* Root of the tree to be walked */
- void (*action)(const void *, VISIT, int);
- int level;
+trecurse(const node_t *root, /* Root of the tree to be walked */
+ cmp_fn_t action, int level)
{
if (root->llink == NULL && root->rlink == NULL)
@@ -49,9 +46,7 @@ trecurse(root, action, level)
/* Walk the nodes of a tree */
void
-twalk(vroot, action)
- const void *vroot; /* Root of the tree to be walked */
- void (*action)(const void *, VISIT, int);
+twalk(const void *vroot, cmp_fn_t action) /* Root of the tree to be walked */
{
if (vroot != NULL && action != NULL)
trecurse(vroot, action, 0);
OpenPOWER on IntegriCloud