This source file includes following definitions.
- gl_list_create_empty
- gl_list_create
- gl_list_node_set_value
- gl_list_set_at
- gl_list_set_first
- gl_list_set_last
- gl_list_add_first
- gl_list_add_last
- gl_list_add_before
- gl_list_add_after
- gl_list_add_at
- gl_sortedlist_add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef _GL_XLIST_H
19 #define _GL_XLIST_H
20
21 #include "gl_list.h"
22 #include "xalloc.h"
23
24 #ifndef _GL_INLINE_HEADER_BEGIN
25 #error "Please include config.h first."
26 #endif
27 _GL_INLINE_HEADER_BEGIN
28 #ifndef GL_XLIST_INLINE
29 # define GL_XLIST_INLINE _GL_INLINE
30 #endif
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36
37
38
39 #if 0
40 extern gl_list_t gl_list_create_empty (gl_list_implementation_t implementation,
41 gl_listelement_equals_fn equals_fn,
42 gl_listelement_hashcode_fn hashcode_fn,
43 gl_listelement_dispose_fn dispose_fn,
44 bool allow_duplicates)
45
46 _GL_ATTRIBUTE_RETURNS_NONNULL;
47 extern gl_list_t gl_list_create (gl_list_implementation_t implementation,
48 gl_listelement_equals_fn equals_fn,
49 gl_listelement_hashcode_fn hashcode_fn,
50 gl_listelement_dispose_fn dispose_fn,
51 bool allow_duplicates,
52 size_t count, const void **contents)
53
54 _GL_ATTRIBUTE_RETURNS_NONNULL;
55 extern void gl_list_node_set_value (gl_list_t list, gl_list_node_t node,
56 const void *elt);
57 extern gl_list_node_t gl_list_set_at (gl_list_t list, size_t position,
58 const void *elt);
59 extern gl_list_node_t gl_list_set_first (gl_list_t list, const void *elt);
60 extern gl_list_node_t gl_list_set_last (gl_list_t list, const void *elt);
61 extern gl_list_node_t gl_list_add_first (gl_list_t list, const void *elt);
62 extern gl_list_node_t gl_list_add_last (gl_list_t list, const void *elt);
63 extern gl_list_node_t gl_list_add_before (gl_list_t list, gl_list_node_t node,
64 const void *elt);
65 extern gl_list_node_t gl_list_add_after (gl_list_t list, gl_list_node_t node,
66 const void *elt);
67 extern gl_list_node_t gl_list_add_at (gl_list_t list, size_t position,
68 const void *elt);
69 extern gl_list_node_t gl_sortedlist_add (gl_list_t list,
70 gl_listelement_compar_fn compar,
71 const void *elt);
72 #endif
73
74 GL_XLIST_INLINE
75
76 _GL_ATTRIBUTE_RETURNS_NONNULL
77 gl_list_t
78 gl_list_create_empty (gl_list_implementation_t implementation,
79 gl_listelement_equals_fn equals_fn,
80 gl_listelement_hashcode_fn hashcode_fn,
81 gl_listelement_dispose_fn dispose_fn,
82 bool allow_duplicates)
83 {
84 gl_list_t result =
85 gl_list_nx_create_empty (implementation, equals_fn, hashcode_fn, dispose_fn,
86 allow_duplicates);
87 if (result == NULL)
88 xalloc_die ();
89 return result;
90 }
91
92 GL_XLIST_INLINE
93
94 _GL_ATTRIBUTE_RETURNS_NONNULL
95 gl_list_t
96 gl_list_create (gl_list_implementation_t implementation,
97 gl_listelement_equals_fn equals_fn,
98 gl_listelement_hashcode_fn hashcode_fn,
99 gl_listelement_dispose_fn dispose_fn,
100 bool allow_duplicates,
101 size_t count, const void **contents)
102 {
103 gl_list_t result =
104 gl_list_nx_create (implementation, equals_fn, hashcode_fn, dispose_fn,
105 allow_duplicates, count, contents);
106 if (result == NULL)
107 xalloc_die ();
108 return result;
109 }
110
111 GL_XLIST_INLINE void
112 gl_list_node_set_value (gl_list_t list, gl_list_node_t node, const void *elt)
113 {
114 int result = gl_list_node_nx_set_value (list, node, elt);
115 if (result < 0)
116 xalloc_die ();
117 }
118
119 GL_XLIST_INLINE gl_list_node_t
120 gl_list_set_at (gl_list_t list, size_t position, const void *elt)
121 {
122 gl_list_node_t result = gl_list_nx_set_at (list, position, elt);
123 if (result == NULL)
124 xalloc_die ();
125 return result;
126 }
127
128 GL_XLIST_INLINE gl_list_node_t
129 gl_list_set_first (gl_list_t list, const void *elt)
130 {
131 gl_list_node_t result = gl_list_nx_set_first (list, elt);
132 if (result == NULL)
133 xalloc_die ();
134 return result;
135 }
136
137 GL_XLIST_INLINE gl_list_node_t
138 gl_list_set_last (gl_list_t list, const void *elt)
139 {
140 gl_list_node_t result = gl_list_nx_set_last (list, elt);
141 if (result == NULL)
142 xalloc_die ();
143 return result;
144 }
145
146 GL_XLIST_INLINE gl_list_node_t
147 gl_list_add_first (gl_list_t list, const void *elt)
148 {
149 gl_list_node_t result = gl_list_nx_add_first (list, elt);
150 if (result == NULL)
151 xalloc_die ();
152 return result;
153 }
154
155 GL_XLIST_INLINE gl_list_node_t
156 gl_list_add_last (gl_list_t list, const void *elt)
157 {
158 gl_list_node_t result = gl_list_nx_add_last (list, elt);
159 if (result == NULL)
160 xalloc_die ();
161 return result;
162 }
163
164 GL_XLIST_INLINE gl_list_node_t
165 gl_list_add_before (gl_list_t list, gl_list_node_t node, const void *elt)
166 {
167 gl_list_node_t result = gl_list_nx_add_before (list, node, elt);
168 if (result == NULL)
169 xalloc_die ();
170 return result;
171 }
172
173 GL_XLIST_INLINE gl_list_node_t
174 gl_list_add_after (gl_list_t list, gl_list_node_t node, const void *elt)
175 {
176 gl_list_node_t result = gl_list_nx_add_after (list, node, elt);
177 if (result == NULL)
178 xalloc_die ();
179 return result;
180 }
181
182 GL_XLIST_INLINE gl_list_node_t
183 gl_list_add_at (gl_list_t list, size_t position, const void *elt)
184 {
185 gl_list_node_t result = gl_list_nx_add_at (list, position, elt);
186 if (result == NULL)
187 xalloc_die ();
188 return result;
189 }
190
191 GL_XLIST_INLINE gl_list_node_t
192 gl_sortedlist_add (gl_list_t list, gl_listelement_compar_fn compar,
193 const void *elt)
194 {
195 gl_list_node_t result = gl_sortedlist_nx_add (list, compar, elt);
196 if (result == NULL)
197 xalloc_die ();
198 return result;
199 }
200
201 #ifdef __cplusplus
202 }
203 #endif
204
205 _GL_INLINE_HEADER_END
206
207 #endif