Cygwin: mmap: allow remapping part of an existing anonymous mapping
[newlib-cygwin.git] / newlib / libc / include / search.h
blobed321b0f645ce5f7ae693784af57675fea1d0557
1 /* $NetBSD: search.h,v 1.12 1999/02/22 10:34:28 christos Exp $ */
2 /* $FreeBSD: src/include/search.h,v 1.4 2002/03/23 17:24:53 imp Exp $ */
4 /*
5 * Written by J.T. Conklin <jtc@netbsd.org>
6 * Public domain.
7 */
9 #ifndef _SEARCH_H_
10 #define _SEARCH_H_
12 #include <sys/cdefs.h>
13 #include <machine/ansi.h>
14 #include <sys/types.h>
16 typedef struct entry {
17 char *key;
18 void *data;
19 } ENTRY;
21 typedef enum {
22 FIND, ENTER
23 } ACTION;
25 typedef enum {
26 preorder,
27 postorder,
28 endorder,
29 leaf
30 } VISIT;
32 #ifdef _SEARCH_PRIVATE
33 typedef struct node {
34 char *key;
35 struct node *llink, *rlink;
36 } node_t;
37 #endif
39 struct hsearch_data
41 struct internal_head *htable;
42 size_t htablesize;
45 #ifndef __compar_fn_t_defined
46 #define __compar_fn_t_defined
47 typedef int (*__compar_fn_t) (const void *, const void *);
48 #endif
50 __BEGIN_DECLS
51 int hcreate(size_t);
52 void hdestroy(void);
53 ENTRY *hsearch(ENTRY, ACTION);
54 int hcreate_r(size_t, struct hsearch_data *);
55 void hdestroy_r(struct hsearch_data *);
56 int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
57 void *tdelete(const void *__restrict, void **__restrict, __compar_fn_t);
58 void tdestroy (void *, void (*)(void *));
59 void *tfind(const void *, void **, __compar_fn_t);
60 void *tsearch(const void *, void **, __compar_fn_t);
61 void twalk(const void *, void (*)(const void *, VISIT, int));
62 __END_DECLS
64 #endif /* !_SEARCH_H_ */