Files
WrldBox/.tmp_zig/lib/zig/libc/mingw/stdio/vasprintf.c
swim67667 c17dfc94ce
Some checks failed
Build Project / build (ubuntu-latest) (push) Failing after 12m33s
added multi-compiling stuff (only works on my mac for now)
2026-06-28 16:40:20 -04:00

26 lines
555 B
C

#define _GNU_SOURCE
#define __CRT__NO_INLINE
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
int vasprintf(char ** __restrict__ ret,
const char * __restrict__ format,
va_list ap) {
int len;
/* Get Length */
len = _vscprintf(format,ap);
if (len < 0) return -1;
/* +1 for \0 terminator. */
*ret = malloc(len + 1);
/* Check malloc fail*/
if (!*ret) return -1;
/* Write String */
_vsnprintf(*ret,len+1,format,ap);
/* Terminate explicitly */
(*ret)[len] = '\0';
return len;
}