std: remove the asprintf/vasprintf implementation

This commit is contained in:
Lephe 2021-06-07 19:04:48 +02:00
parent 991b616a10
commit b25924d740
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
2 changed files with 0 additions and 39 deletions

View File

@ -63,7 +63,6 @@ set(SOURCES_COMMON
src/rtc/rtc.c
src/rtc/rtc_ticks.c
src/spu/spu.c
src/std/aprint.c
src/std/malloc.c
src/tmu/inth-etmu.s
src/tmu/inth-tmu.s

View File

@ -1,38 +0,0 @@
//---
// gint:src:aprint - Allocating extensions to formatted printing
//---
#include <stdio.h>
#include <gint/std/stdlib.h>
#include <gint/defs/attributes.h>
/* vasprintf() */
GWEAK int vasprintf(char **strp, char const *format, va_list args1)
{
va_list args2;
va_copy(args2, args1);
int count = vsnprintf(NULL, 0, format, args1);
va_end(args1);
char *str = malloc(count + 1);
if(str) count = vsnprintf(str, count + 1, format, args2);
va_end(args2);
if(!str) return -1;
*strp = str;
return count;
}
/* asprintf() */
GWEAK int asprintf(char **strp, char const *format, ...)
{
va_list args;
va_start(args, format);
int count = vasprintf(strp, format, args);
va_end(args);
return count;
}