122 * @param allocator the allocator |
122 * @param allocator the allocator |
123 * @param n the number of bytes |
123 * @param n the number of bytes |
124 * @return a pointer to the allocated memory |
124 * @return a pointer to the allocated memory |
125 */ |
125 */ |
126 void *cxMalloc( |
126 void *cxMalloc( |
127 CxAllocator *allocator, |
127 CxAllocator const *allocator, |
128 size_t n |
128 size_t n |
129 ) |
129 ) |
130 __attribute__((__malloc__)) |
130 __attribute__((__malloc__)) |
131 __attribute__((__alloc_size__(2))); |
131 __attribute__((__alloc_size__(2))); |
132 |
132 |
141 * @param mem pointer to the previously allocated block |
141 * @param mem pointer to the previously allocated block |
142 * @param n the new size in bytes |
142 * @param n the new size in bytes |
143 * @return a pointer to the re-allocated memory |
143 * @return a pointer to the re-allocated memory |
144 */ |
144 */ |
145 void *cxRealloc( |
145 void *cxRealloc( |
146 CxAllocator *allocator, |
146 CxAllocator const *allocator, |
147 void *mem, |
147 void *mem, |
148 size_t n |
148 size_t n |
149 ) |
149 ) |
150 __attribute__((__warn_unused_result__)) |
150 __attribute__((__warn_unused_result__)) |
151 __attribute__((__alloc_size__(3))); |
151 __attribute__((__alloc_size__(3))); |
164 * @param mem pointer to the pointer to allocated block |
164 * @param mem pointer to the pointer to allocated block |
165 * @param n the new size in bytes |
165 * @param n the new size in bytes |
166 * @return zero on success, non-zero on failure |
166 * @return zero on success, non-zero on failure |
167 */ |
167 */ |
168 int cxReallocate( |
168 int cxReallocate( |
169 CxAllocator *allocator, |
169 CxAllocator const *allocator, |
170 void **mem, |
170 void **mem, |
171 size_t n |
171 size_t n |
172 ) |
172 ) |
173 __attribute__((__nonnull__)); |
173 __attribute__((__nonnull__)); |
174 |
174 |
179 * @param nelem the number of elements |
179 * @param nelem the number of elements |
180 * @param n the size of each element in bytes |
180 * @param n the size of each element in bytes |
181 * @return a pointer to the allocated memory |
181 * @return a pointer to the allocated memory |
182 */ |
182 */ |
183 void *cxCalloc( |
183 void *cxCalloc( |
184 CxAllocator *allocator, |
184 CxAllocator const *allocator, |
185 size_t nelem, |
185 size_t nelem, |
186 size_t n |
186 size_t n |
187 ) |
187 ) |
188 __attribute__((__malloc__)) |
188 __attribute__((__malloc__)) |
189 __attribute__((__alloc_size__(2, 3))); |
189 __attribute__((__alloc_size__(2, 3))); |