src/ucx/cx/allocator.h

changeset 504
c094afcdfb27
parent 490
d218607f5a7e
equal deleted inserted replaced
503:aeaf7db26fac 504:c094afcdfb27
131 void *data, 131 void *data,
132 void *memory 132 void *memory
133 ) __attribute__((__nonnull__(2))); 133 ) __attribute__((__nonnull__(2)));
134 134
135 /** 135 /**
136 * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
137 *
138 * \par Error handling
139 * \c errno will be set by realloc() on failure.
140 *
141 * @param mem pointer to the pointer to allocated block
142 * @param n the new size in bytes
143 * @return zero on success, non-zero on failure
144 */
145 int cx_reallocate(
146 void **mem,
147 size_t n
148 )
149 __attribute__((__nonnull__));
150
151 /**
136 * Allocate \p n bytes of memory. 152 * Allocate \p n bytes of memory.
137 * 153 *
138 * @param allocator the allocator 154 * @param allocator the allocator
139 * @param n the number of bytes 155 * @param n the number of bytes
140 * @return a pointer to the allocated memory 156 * @return a pointer to the allocated memory
167 __attribute__((__alloc_size__(3))); 183 __attribute__((__alloc_size__(3)));
168 184
169 /** 185 /**
170 * Re-allocate a previously allocated block and changes the pointer in-place, if necessary. 186 * Re-allocate a previously allocated block and changes the pointer in-place, if necessary.
171 * This function acts like cxRealloc() using the pointer pointed to by \p mem. 187 * This function acts like cxRealloc() using the pointer pointed to by \p mem.
172 * On success, the pointer is changed to the new location (in case the
173 * 188 *
174 * \note Re-allocating a block allocated by a different allocator is undefined. 189 * \note Re-allocating a block allocated by a different allocator is undefined.
175 * 190 *
176 * \par Error handling 191 * \par Error handling
177 * \c errno will be set, if the underlying realloc function does so. 192 * \c errno will be set, if the underlying realloc function does so.

mercurial