Deleted Added
full compact
search.h (103012) search.h (104399)
1/* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
2/* $FreeBSD: head/include/search.h 103012 2002-09-06 11:24:06Z tjr $ */
3
4/*
1/*-
5 * Written by J.T. Conklin <jtc@netbsd.org>
6 * Public domain.
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: head/include/search.h 104399 2002-10-03 06:31:16Z mike $
7 */
8
9#ifndef _SEARCH_H_
10#define _SEARCH_H_
11
12#include <sys/cdefs.h>
13#include <sys/_types.h>
14
15#ifndef _SIZE_T_DECLARED
16typedef __size_t size_t;
17#define _SIZE_T_DECLARED
18#endif
19
7 */
8
9#ifndef _SEARCH_H_
10#define _SEARCH_H_
11
12#include <sys/cdefs.h>
13#include <sys/_types.h>
14
15#ifndef _SIZE_T_DECLARED
16typedef __size_t size_t;
17#define _SIZE_T_DECLARED
18#endif
19
20typedef struct entry {
21 char *key;
22 void *data;
20typedef struct entry {
21 char *key;
22 void *data;
23} ENTRY;
24
23} ENTRY;
24
25typedef enum {
25typedef enum {
26 FIND, ENTER
27} ACTION;
28
26 FIND, ENTER
27} ACTION;
28
29typedef enum {
29typedef enum {
30 preorder,
31 postorder,
32 endorder,
33 leaf
34} VISIT;
35
36#ifdef _SEARCH_PRIVATE
30 preorder,
31 postorder,
32 endorder,
33 leaf
34} VISIT;
35
36#ifdef _SEARCH_PRIVATE
37typedef struct node {
37typedef struct node {
38 char *key;
39 struct node *llink, *rlink;
40} node_t;
41#endif
42
43__BEGIN_DECLS
44int hcreate(size_t);
45void hdestroy(void);
46ENTRY *hsearch(ENTRY, ACTION);
47void *tdelete(const void * __restrict, void ** __restrict,
48 int (*)(const void *, const void *));
38 char *key;
39 struct node *llink, *rlink;
40} node_t;
41#endif
42
43__BEGIN_DECLS
44int hcreate(size_t);
45void hdestroy(void);
46ENTRY *hsearch(ENTRY, ACTION);
47void *tdelete(const void * __restrict, void ** __restrict,
48 int (*)(const void *, const void *));
49void *tfind(const void *, void **, int (*)(const void *, const void *));
49void *tfind(const void *, void * const *,
50 int (*)(const void *, const void *));
50void *tsearch(const void *, void **, int (*)(const void *, const void *));
51void *tsearch(const void *, void **, int (*)(const void *, const void *));
51void twalk(const void *, void (*)(const void *, VISIT, int));
52void twalk(const void *, void (*)(const void *, VISIT, int));
53/*
54 * XXX missing insque(), lsearch(), remque().
55 */
52__END_DECLS
53
54#endif /* !_SEARCH_H_ */
56__END_DECLS
57
58#endif /* !_SEARCH_H_ */