diff options
author | pfg <pfg@FreeBSD.org> | 2014-07-21 22:47:59 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2014-07-21 22:47:59 +0000 |
commit | f5657a9f1cb2b536b62d19ff125fece464f29581 (patch) | |
tree | e1fa5505ad0535abee62ca48f8a853dadbeb5363 /lib/libc/stdlib/twalk.c | |
parent | 832f66713038de9143d814e4a87f26dd2032ee6d (diff) | |
download | FreeBSD-src-f5657a9f1cb2b536b62d19ff125fece464f29581.zip FreeBSD-src-f5657a9f1cb2b536b62d19ff125fece464f29581.tar.gz |
MFC r268644:
libc/stdlib: Minor cleanups to code originating in NetBSD
Mostly ANSIfication and typos.
Obtained from: NetBSD
Diffstat (limited to 'lib/libc/stdlib/twalk.c')
-rw-r--r-- | lib/libc/stdlib/twalk.c | 17 |
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); |