fixes
This commit is contained in:
@@ -831,11 +831,13 @@ int vasprintf(char **ptr, const char *format, va_list ap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
va_list ap_copy;
|
||||
va_copy(ap_copy, ap);
|
||||
ret = vsnprintf((char *) NULL, 0, format, ap);
|
||||
if (ret + 1 <= 1) { return ret; } /* pts: bit of old unsigned trick... */
|
||||
|
||||
if (NULL == (*ptr = (char *) my_malloc(ret + 1))) { return -1; }
|
||||
ret = vsnprintf(*ptr, ret + 1, format, ap);
|
||||
ret = vsnprintf(*ptr, ret + 1, format, ap_copy);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,11 @@ int fixup_vprintf(const char *format, va_list ap);
|
||||
#define PRINTF(...) fixup_printf(__VA_ARGS__)
|
||||
#define VPRINTF(...) fixup_vprintf(__VA_ARGS__)
|
||||
|
||||
// for debug
|
||||
//#include <stdio.h>
|
||||
//#define PRINTF(...) printf(__VA_ARGS__)
|
||||
//#define SPRINTF(...) sprintf(__VA_ARGS__)
|
||||
|
||||
// extern
|
||||
|
||||
extern void stdout_puts(const char *s);
|
||||
|
||||
Reference in New Issue
Block a user