OLD | NEW |
1 #ifndef _SEARCH_H | 1 #ifndef _SEARCH_H |
2 #define _SEARCH_H | 2 #define _SEARCH_H |
3 | 3 |
4 #ifdef __cplusplus | 4 #ifdef __cplusplus |
5 extern "C" { | 5 extern "C" { |
6 #endif | 6 #endif |
7 | 7 |
8 #include <features.h> | 8 #include <features.h> |
9 | 9 |
10 #define __NEED_size_t | 10 #define __NEED_size_t |
11 #include <bits/alltypes.h> | 11 #include <bits/alltypes.h> |
12 | 12 |
13 typedef enum { FIND, ENTER } ACTION; | 13 typedef enum { FIND, ENTER } ACTION; |
14 typedef enum { preorder, postorder, endorder, leaf } VISIT; | 14 typedef enum { preorder, postorder, endorder, leaf } VISIT; |
15 | 15 |
16 typedef struct entry { | 16 typedef struct entry { |
17 » char *key; | 17 char* key; |
18 » void *data; | 18 void* data; |
19 } ENTRY; | 19 } ENTRY; |
20 | 20 |
21 int hcreate(size_t); | 21 int hcreate(size_t); |
22 void hdestroy(void); | 22 void hdestroy(void); |
23 ENTRY *hsearch(ENTRY, ACTION); | 23 ENTRY* hsearch(ENTRY, ACTION); |
24 | 24 |
25 #ifdef _GNU_SOURCE | 25 #ifdef _GNU_SOURCE |
26 struct hsearch_data { | 26 struct hsearch_data { |
27 » struct __tab *__tab; | 27 struct __tab* __tab; |
28 » unsigned int __unused1; | 28 unsigned int __unused1; |
29 » unsigned int __unused2; | 29 unsigned int __unused2; |
30 }; | 30 }; |
31 | 31 |
32 int hcreate_r(size_t, struct hsearch_data *); | 32 int hcreate_r(size_t, struct hsearch_data*); |
33 void hdestroy_r(struct hsearch_data *); | 33 void hdestroy_r(struct hsearch_data*); |
34 int hsearch_r(ENTRY, ACTION, ENTRY **, struct hsearch_data *); | 34 int hsearch_r(ENTRY, ACTION, ENTRY**, struct hsearch_data*); |
35 #endif | 35 #endif |
36 | 36 |
37 void insque(void *, void *); | 37 void insque(void*, void*); |
38 void remque(void *); | 38 void remque(void*); |
39 | 39 |
40 void *lsearch(const void *, void *, size_t *, size_t, | 40 void* lsearch(const void*, |
41 » int (*)(const void *, const void *)); | 41 void*, |
42 void *lfind(const void *, const void *, size_t *, size_t, | 42 size_t*, |
43 » int (*)(const void *, const void *)); | 43 size_t, |
| 44 int (*)(const void*, const void*)); |
| 45 void* lfind(const void*, |
| 46 const void*, |
| 47 size_t*, |
| 48 size_t, |
| 49 int (*)(const void*, const void*)); |
44 | 50 |
45 void *tdelete(const void *__restrict, void **__restrict, int(*)(const void *, co
nst void *)); | 51 void* tdelete(const void* __restrict, |
46 void *tfind(const void *, void *const *, int(*)(const void *, const void *)); | 52 void** __restrict, |
47 void *tsearch(const void *, void **, int (*)(const void *, const void *)); | 53 int (*)(const void*, const void*)); |
48 void twalk(const void *, void (*)(const void *, VISIT, int)); | 54 void* tfind(const void*, void* const*, int (*)(const void*, const void*)); |
| 55 void* tsearch(const void*, void**, int (*)(const void*, const void*)); |
| 56 void twalk(const void*, void (*)(const void*, VISIT, int)); |
49 | 57 |
50 #ifdef _GNU_SOURCE | 58 #ifdef _GNU_SOURCE |
51 struct qelem { | 59 struct qelem { |
52 » struct qelem *q_forw, *q_back; | 60 struct qelem *q_forw, *q_back; |
53 » char q_data[1]; | 61 char q_data[1]; |
54 }; | 62 }; |
55 | 63 |
56 void tdestroy(void *, void (*)(void *)); | 64 void tdestroy(void*, void (*)(void*)); |
57 #endif | 65 #endif |
58 | 66 |
59 #ifdef __cplusplus | 67 #ifdef __cplusplus |
60 } | 68 } |
61 #endif | 69 #endif |
62 | 70 |
63 #endif | 71 #endif |
OLD | NEW |