19 va_copy(argcopy, pargs);
20 retval = vsnprintf(NULL, 0, format, argcopy);
25 int vasprintf(
char **strp,
const char *fmt, va_list ap) {
27 if (len == -1)
return -1;
28 char *str = malloc((
size_t) len + 1);
30 int r = vsnprintf(str, len + 1, fmt, ap);
31 if (r == -1)
return free(str), -1;
36 int asprintf(
char *strp[],
const char *fmt, ...) {
44 #endif // !_GNU_SOURCE