blob: b2c0e6b50c906b36208099ecd47757bbdb59e911 [file] [log] [blame]
Ben Cheng21eab512012-03-13 23:04:57 -07001/*-
2 * Written by J.T. Conklin <jtc@netbsd.org>
3 * Public domain.
4 *
5 * $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $
6 * $FreeBSD: release/9.0.0/include/search.h 105250 2002-10-16 14:29:23Z robert $
7 */
8
9#ifndef _SEARCH_H_
10#define _SEARCH_H_
11
12#include <sys/cdefs.h>
Elliott Hughes7f3a2722014-04-01 12:40:00 -070013#include <sys/types.h>
Ben Cheng21eab512012-03-13 23:04:57 -070014
Elliott Hughes7f3a2722014-04-01 12:40:00 -070015typedef enum {
16 preorder,
17 postorder,
18 endorder,
19 leaf
Ben Cheng21eab512012-03-13 23:04:57 -070020} VISIT;
21
22#ifdef _SEARCH_PRIVATE
Elliott Hughes7f3a2722014-04-01 12:40:00 -070023typedef struct node {
24 char* key;
25 struct node* llink;
26 struct node* rlink;
Ben Cheng21eab512012-03-13 23:04:57 -070027} node_t;
28#endif
29
30__BEGIN_DECLS
Elliott Hughes7f3a2722014-04-01 12:40:00 -070031
32void* lfind(const void*, const void*, size_t*, size_t, int (*)(const void*, const void*));
33void* lsearch(const void*, void*, size_t*, size_t, int (*)(const void*, const void*));
34
35void* tdelete(const void* __restrict, void** __restrict, int (*)(const void*, const void*));
36void tdestroy(void*, void (*)(void*));
37void* tfind(const void*, void* const*, int (*)(const void*, const void*));
38void* tsearch(const void*, void**, int (*)(const void*, const void*));
39void twalk(const void*, void (*)(const void*, VISIT, int));
40
Ben Cheng21eab512012-03-13 23:04:57 -070041__END_DECLS
42
43#endif /* !_SEARCH_H_ */