154 * @param allocator the allocator |
154 * @param allocator the allocator |
155 * @param n the number of bytes |
155 * @param n the number of bytes |
156 * @return a pointer to the allocated memory |
156 * @return a pointer to the allocated memory |
157 */ |
157 */ |
158 void *cxMalloc( |
158 void *cxMalloc( |
159 CxAllocator const *allocator, |
159 const CxAllocator *allocator, |
160 size_t n |
160 size_t n |
161 ) |
161 ) |
162 __attribute__((__malloc__)) |
162 __attribute__((__malloc__)) |
163 __attribute__((__alloc_size__(2))); |
163 __attribute__((__alloc_size__(2))); |
164 |
164 |
173 * @param mem pointer to the previously allocated block |
173 * @param mem pointer to the previously allocated block |
174 * @param n the new size in bytes |
174 * @param n the new size in bytes |
175 * @return a pointer to the re-allocated memory |
175 * @return a pointer to the re-allocated memory |
176 */ |
176 */ |
177 void *cxRealloc( |
177 void *cxRealloc( |
178 CxAllocator const *allocator, |
178 const CxAllocator *allocator, |
179 void *mem, |
179 void *mem, |
180 size_t n |
180 size_t n |
181 ) |
181 ) |
182 __attribute__((__warn_unused_result__)) |
182 __attribute__((__warn_unused_result__)) |
183 __attribute__((__alloc_size__(3))); |
183 __attribute__((__alloc_size__(3))); |
195 * @param mem pointer to the pointer to allocated block |
195 * @param mem pointer to the pointer to allocated block |
196 * @param n the new size in bytes |
196 * @param n the new size in bytes |
197 * @return zero on success, non-zero on failure |
197 * @return zero on success, non-zero on failure |
198 */ |
198 */ |
199 int cxReallocate( |
199 int cxReallocate( |
200 CxAllocator const *allocator, |
200 const CxAllocator *allocator, |
201 void **mem, |
201 void **mem, |
202 size_t n |
202 size_t n |
203 ) |
203 ) |
204 __attribute__((__nonnull__)); |
204 __attribute__((__nonnull__)); |
205 |
205 |
210 * @param nelem the number of elements |
210 * @param nelem the number of elements |
211 * @param n the size of each element in bytes |
211 * @param n the size of each element in bytes |
212 * @return a pointer to the allocated memory |
212 * @return a pointer to the allocated memory |
213 */ |
213 */ |
214 void *cxCalloc( |
214 void *cxCalloc( |
215 CxAllocator const *allocator, |
215 const CxAllocator *allocator, |
216 size_t nelem, |
216 size_t nelem, |
217 size_t n |
217 size_t n |
218 ) |
218 ) |
219 __attribute__((__malloc__)) |
219 __attribute__((__malloc__)) |
220 __attribute__((__alloc_size__(2, 3))); |
220 __attribute__((__alloc_size__(2, 3))); |