getaddrinfo: add EAI_NODATA error code to distinguish NODATA vs NxDomain
[musl.git] / include / search.h
blob02e407e3c2aba21b6fe4d015c6430c3155c3db69
1 #ifndef _SEARCH_H
2 #define _SEARCH_H
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
8 #include <features.h>
10 #define __NEED_size_t
11 #include <bits/alltypes.h>
13 typedef enum { FIND, ENTER } ACTION;
14 typedef enum { preorder, postorder, endorder, leaf } VISIT;
16 typedef struct entry {
17 char *key;
18 void *data;
19 } ENTRY;
21 int hcreate(size_t);
22 void hdestroy(void);
23 ENTRY *hsearch(ENTRY, ACTION);
25 #ifdef _GNU_SOURCE
26 struct hsearch_data {
27 struct __tab *__tab;
28 unsigned int __unused1;
29 unsigned int __unused2;
32 int hcreate_r(size_t, struct hsearch_data *);
33 void hdestroy_r(struct hsearch_data *);
34 int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *);
35 #endif
37 void insque(void *, void *);
38 void remque(void *);
40 void *lsearch(const void *, void *, size_t *, size_t,
41 int (*)(const void *, const void *));
42 void *lfind(const void *, const void *, size_t *, size_t,
43 int (*)(const void *, const void *));
45 void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, const void *));
46 void *tfind(const void *, void *const *, int(*)(const void *, const void *));
47 void *tsearch(const void *, void **, int (*)(const void *, const void *));
48 void twalk(const void *, void (*)(const void *, VISIT, int));
50 #ifdef _GNU_SOURCE
51 struct qelem {
52 struct qelem *q_forw, *q_back;
53 char q_data[1];
56 void tdestroy(void *, void (*)(void *));
57 #endif
59 #ifdef __cplusplus
61 #endif
63 #endif