1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39 #ifndef UCX_ARRAY_LIST_H
40 #define UCX_ARRAY_LIST_H
41
42 #include "list.h"
43
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47
48
49
50
51 struct cx_array_reallocator_s {
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66 void *(*realloc)(
67 void *array,
68 size_t capacity,
69 size_t elem_size,
70 struct cx_array_reallocator_s *alloc
71 );
72
73
74
75
76 void *ptr1;
77
78
79
80 void *ptr2;
81
82
83
84 size_t int1;
85
86
87
88 size_t int2;
89 };
90
91
92
93
94 enum cx_array_copy_result {
95 CX_ARRAY_COPY_SUCCESS,
96 CX_ARRAY_COPY_REALLOC_NOT_SUPPORTED,
97 CX_ARRAY_COPY_REALLOC_FAILED,
98 };
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125 enum cx_array_copy_result cx_array_copy(
126 void **target,
127 size_t *size,
128 size_t *capacity,
129 size_t index,
130 void const *src,
131 size_t elem_size,
132 size_t elem_count,
133 struct cx_array_reallocator_s *reallocator
134 ) __attribute__((__nonnull__(
1,
2,
5)));
135
136
137
138
139
140
141
142
143
144
145 void cx_array_swap(
146 void *arr,
147 size_t elem_size,
148 size_t idx1,
149 size_t idx2
150 ) __attribute__((__nonnull__));
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166 CxList *cxArrayListCreate(
167 CxAllocator
const *allocator,
168 cx_compare_func comparator,
169 size_t item_size,
170 size_t initial_capacity
171 );
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187 #define cxArrayListCreateSimple(item_size, initial_capacity) \
188 cxArrayListCreate(
NULL,
NULL, item_size, initial_capacity)
189
190 #ifdef __cplusplus
191 }
192 #endif
193
194 #endif
195