ec_mt_asprintf

March 26, 2020 Contributors

Name

ec_mt_asprintf — Memory-typed asprintf function

Synopsis

#include "misc/ec_string.h"

| int **ec_mt_asprintf** ( | mt, |   |
|   | strp, |   |
|   | fmt, |   |
|   | ); |   |

int <var class="pdparam">mt</var>;
char ** <var class="pdparam">strp</var>;
const char * <var class="pdparam">fmt</var>;
...;

Description

Memory-typed asprintf function.

This is a version of asprintf() that takes a Momentum memory type as an argument. For a list of memory types see the section called “Memory Types”.

Parameters

mt

The memory type to use for allocations.

strp

The newly allocated string.

fmt

The format string.

Return Values

Returns the length of the resulting string or -1 if the allocation fails.

Threading

It is legal to call this function in any thread.

See Also

ec_malloc and Memory Functions