118 */ |
118 */ |
119 size_t int2; |
119 size_t int2; |
120 }; |
120 }; |
121 |
121 |
122 /** |
122 /** |
|
123 * Typedef for the array reallocator struct. |
|
124 */ |
|
125 typedef struct cx_array_reallocator_s CxArrayReallocator; |
|
126 |
|
127 /** |
123 * A default stdlib-based array reallocator. |
128 * A default stdlib-based array reallocator. |
124 */ |
129 */ |
125 extern struct cx_array_reallocator_s *cx_array_default_reallocator; |
130 extern struct cx_array_reallocator_s *cx_array_default_reallocator; |
|
131 |
|
132 /** |
|
133 * Creates a new array reallocator. |
|
134 * |
|
135 * When \p allocator is \c NULL, the stdlib default allocator will be used. |
|
136 * |
|
137 * When \p stackmem is not \c NULL, the reallocator is supposed to be used |
|
138 * \em only for the specific array that is initially located at \p stackmem. |
|
139 * When reallocation is needed, the reallocator checks, if the array is |
|
140 * still located at \p stackmem and copies the contents to the heap. |
|
141 * |
|
142 * @param allocator the allocator this reallocator shall be based on |
|
143 * @param stackmem the address of the array when the array is initially located |
|
144 * on the stack |
|
145 * @return an array reallocator |
|
146 */ |
|
147 struct cx_array_reallocator_s cx_array_reallocator( |
|
148 const struct cx_allocator_s *allocator, |
|
149 const void *stackmem |
|
150 ); |
126 |
151 |
127 /** |
152 /** |
128 * Return codes for array functions. |
153 * Return codes for array functions. |
129 */ |
154 */ |
130 enum cx_array_result { |
155 enum cx_array_result { |