provide loff_t for splice syscall
[musl] / include / search.h
1 #ifndef _SEARCH_H
2 #define _SEARCH_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #if __STDC_VERSION__ >= 199901L
9 #define __restrict restrict
10 #elif !defined(__GNUC__)
11 #define __restrict
12 #endif
13
14
15 #define __NEED_size_t
16 #include <bits/alltypes.h>
17
18 typedef enum { FIND, ENTER } ACTION;
19 typedef enum { preorder, postorder, endorder, leaf } VISIT;
20
21 typedef struct {
22         char *key;
23         void *data;
24 } ENTRY;
25
26 int hcreate(size_t);
27 void hdestroy(void);
28 ENTRY *hsearch(ENTRY, ACTION);
29
30 void insque(void *, void *);
31 void remque(void *);
32
33 void *lsearch(const void *, void *, size_t *, size_t,
34         int (*)(const void *, const void *));
35 void *lfind(const void *, const void *, size_t *, size_t,
36         int (*)(const void *, const void *));
37
38 void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
39 void *tfind(const void *, void *const *, int(*)(const void *, const void *));
40 void *tsearch(const void *, void **, int (*)(const void *, const void *));
41 void twalk(const void *, void (*)(const void *, VISIT, int));
42
43 #ifdef _GNU_SOURCE
44 struct qelem {
45         struct qelem *q_forw, *q_back;
46         char q_data[1];
47 };
48
49 void tdestroy(void *, void (*)(void *));
50 #endif
51
52 #ifdef __cplusplus
53 }
54 #endif
55
56 #endif