mdb_asprintf
() and mdb_vasprintf
() Functions
size_t mdb_asprintf(char **ret, uint_t flags, const char *format, ...); size_t mdb_vasprintf(char **ret, uint_t flags, const char *format, va_list);
The mdb_asprintf
() and mdb_vasprintf
() functions behave similarly to the mdb_snprintf
() and mdb_vsnprintf
() functions. However, the mdb_asprintf
() and mdb_vasprintf
() functions use the ret
argument to return a pointer to a sufficiently sized buffer that contains the output string. The mdb_alloc
() function uses the flags
argument to allocate the buffer. You can use the mdb_strfree
() function to free data in that buffer. If the flags
argument does not contain UM_SLEEP
, the allocation might fail. If the allocation fails, these functions return -1
and the ret
pointer has NULL
written into it. If these functions succeed, they return the length of the string that is stored in the buffer.