mirror of
https://git.planet-casio.com/Lephenixnoir/gint.git
synced 2024-12-28 04:23:36 +01:00
std: remove the asprintf/vasprintf implementation
This commit is contained in:
parent
991b616a10
commit
b25924d740
2 changed files with 0 additions and 39 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in a new issue