Deleted Added
full compact
search.h (292613) search.h (292767)
1/*-
2 * Written by J.T. Conklin <jtc@NetBSD.org>
3 * Public domain.
4 *
5 * $NetBSD: search.h,v 1.16 2005/02/03 04:39:32 perry Exp $
1/*-
2 * Written by J.T. Conklin <jtc@NetBSD.org>
3 * Public domain.
4 *
5 * $NetBSD: search.h,v 1.16 2005/02/03 04:39:32 perry Exp $
6 * $FreeBSD: head/include/search.h 292613 2015-12-22 18:12:11Z ed $
6 * $FreeBSD: head/include/search.h 292767 2015-12-27 07:50:11Z ed $
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;
23} ENTRY;
24
25typedef enum {
26 FIND, ENTER
27} ACTION;
28
29typedef enum {
30 preorder,
31 postorder,
32 endorder,
33 leaf
34} VISIT;
35
36#ifdef _SEARCH_PRIVATE
37typedef struct node {
38 void *key;
39 struct node *llink, *rlink;
40 signed char balance;
41} node_t;
42
43struct que_elem {
44 struct que_elem *next;
45 struct que_elem *prev;
46};
47#endif
48
49#if __BSD_VISIBLE
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;
23} ENTRY;
24
25typedef enum {
26 FIND, ENTER
27} ACTION;
28
29typedef enum {
30 preorder,
31 postorder,
32 endorder,
33 leaf
34} VISIT;
35
36#ifdef _SEARCH_PRIVATE
37typedef struct node {
38 void *key;
39 struct node *llink, *rlink;
40 signed char balance;
41} node_t;
42
43struct que_elem {
44 struct que_elem *next;
45 struct que_elem *prev;
46};
47#endif
48
49#if __BSD_VISIBLE
50struct _ENTRY;
51struct hsearch_data {
50struct hsearch_data {
52 struct _ENTRY *table;
53 size_t size;
54 size_t filled;
51 struct __hsearch *__hsearch;
55};
56#endif
57
58__BEGIN_DECLS
59int hcreate(size_t);
60void hdestroy(void);
61ENTRY *hsearch(ENTRY, ACTION);
62void insque(void *, void *);
63void *lfind(const void *, const void *, size_t *, size_t,
64 int (*)(const void *, const void *));
65void *lsearch(const void *, void *, size_t *, size_t,
66 int (*)(const void *, const void *));
67void remque(void *);
68void *tdelete(const void * __restrict, void ** __restrict,
69 int (*)(const void *, const void *));
70void *tfind(const void *, void * const *,
71 int (*)(const void *, const void *));
72void *tsearch(const void *, void **, int (*)(const void *, const void *));
73void twalk(const void *, void (*)(const void *, VISIT, int));
74
75#if __BSD_VISIBLE
76int hcreate_r(size_t, struct hsearch_data *);
77void hdestroy_r(struct hsearch_data *);
78int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
79#endif
80
81__END_DECLS
82
83#endif /* !_SEARCH_H_ */
52};
53#endif
54
55__BEGIN_DECLS
56int hcreate(size_t);
57void hdestroy(void);
58ENTRY *hsearch(ENTRY, ACTION);
59void insque(void *, void *);
60void *lfind(const void *, const void *, size_t *, size_t,
61 int (*)(const void *, const void *));
62void *lsearch(const void *, void *, size_t *, size_t,
63 int (*)(const void *, const void *));
64void remque(void *);
65void *tdelete(const void * __restrict, void ** __restrict,
66 int (*)(const void *, const void *));
67void *tfind(const void *, void * const *,
68 int (*)(const void *, const void *));
69void *tsearch(const void *, void **, int (*)(const void *, const void *));
70void twalk(const void *, void (*)(const void *, VISIT, int));
71
72#if __BSD_VISIBLE
73int hcreate_r(size_t, struct hsearch_data *);
74void hdestroy_r(struct hsearch_data *);
75int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
76#endif
77
78__END_DECLS
79
80#endif /* !_SEARCH_H_ */