177 * @return the result of memcmp(ptr1, ptr2, *n) |
177 * @return the result of memcmp(ptr1, ptr2, *n) |
178 */ |
178 */ |
179 int ucx_memcmp(void *ptr1, void *ptr2, void *n); |
179 int ucx_memcmp(void *ptr1, void *ptr2, void *n); |
180 |
180 |
181 /** |
181 /** |
182 * A printf like function which writes the output to a stream using a write |
182 * A <code>printf()</code> like function which writes the output to a stream by |
183 * function. |
183 * using a write_func(). |
184 * @param stream the stream where to write the data |
184 * @param stream the stream the data is written to |
185 * @param wfc the write function for the stream |
185 * @param wfc the write function |
186 * @param fmt format string |
186 * @param fmt format string |
187 * @param ... additional arguments |
187 * @param ... additional arguments |
188 * @return the total number of bytes written |
188 * @return the total number of bytes written |
189 */ |
189 */ |
190 int ucx_fprintf(void *stream, write_func wfc, const char *fmt, ...); |
190 int ucx_fprintf(void *stream, write_func wfc, const char *fmt, ...); |
191 |
191 |
192 /** |
192 /** |
193 * Same as ucx_fprintf() but with an argument list instead of variadic |
193 * <code>va_list</code> version of ucx_fprintf(). |
194 * arguments. |
194 * @param stream the stream the data is written to |
195 * @param stream the stream where to write the data |
195 * @param wfc the write function |
196 * @param wfc the write function for the stream |
|
197 * @param fmt format string |
196 * @param fmt format string |
198 * @param ap argument list |
197 * @param ap argument list |
199 * @return the total number of bytes written |
198 * @return the total number of bytes written |
200 * @see ucx_fprintf() |
199 * @see ucx_fprintf() |
201 */ |
200 */ |
202 int ucx_vfprintf(void *stream, write_func wfc, const char *fmt, va_list ap); |
201 int ucx_vfprintf(void *stream, write_func wfc, const char *fmt, va_list ap); |
203 |
202 |
204 /** |
203 /** |
205 * A printf like function which stores the result in a newly created string. |
204 * A <code>printf()</code> like function which allocates space for a sstr_t |
206 * |
205 * the result is written to. |
207 * The sstr_t data is allocated with the allocators ucx_allocator_malloc |
206 * |
208 * function. So it is implementation depended, whether the returned |
207 * <b>Attention</b>: The sstr_t data is allocated with the allocators |
209 * sstr_t.ptr pointer must be passed to the allocators ucx_allocator_free |
208 * ucx_allocator_malloc() function. So it is implementation dependent, if |
210 * function manually. |
209 * the returned sstr_t.ptr pointer must be passed to the allocators |
211 * |
210 * ucx_allocator_free() function manually. |
212 * The sstr_t.ptr of the return value will <i>always</i> be <code>NULL</code>- |
211 * |
213 * terminated. |
212 * <b>Note</b>: The sstr_t.ptr of the return value will <i>always</i> be |
214 * |
213 * <code>NULL</code>-terminated. |
215 * @param allocator a valid instance of an UcxAllocator |
214 * |
|
215 * @param allocator the UcxAllocator used for allocating the result sstr_t |
216 * @param fmt format string |
216 * @param fmt format string |
217 * @param ... additional arguments |
217 * @param ... additional arguments |
218 * @return a new string |
218 * @return a sstr_t containing the formatted string |
219 */ |
219 */ |
220 sstr_t ucx_asprintf(UcxAllocator *allocator, const char *fmt, ...); |
220 sstr_t ucx_asprintf(UcxAllocator *allocator, const char *fmt, ...); |
221 |
221 |
222 /** |
222 /** |
223 * Same as ucx_asprintf() but with an argument list instead of variadic |
223 * <code>va_list</code> version of ucx_asprintf(). |
224 * arguments. |
224 * |
225 * @param allocator a valid instance of an UcxAllocator |
225 * @param allocator the UcxAllocator used for allocating the result sstr_t |
226 * @param fmt format string |
226 * @param fmt format string |
227 * @param ap argument list |
227 * @param ap argument list |
228 * @return a new string |
228 * @return a sstr_t containing the formatted string |
|
229 * @see ucx_asprintf() |
229 */ |
230 */ |
230 sstr_t ucx_vasprintf(UcxAllocator *allocator, const char *fmt, va_list ap); |
231 sstr_t ucx_vasprintf(UcxAllocator *allocator, const char *fmt, va_list ap); |
231 |
232 |
232 #ifdef __cplusplus |
233 #ifdef __cplusplus |
233 } |
234 } |