blob: 6f1250d21fc298776b60d4fbb477728b43218d41 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#ifndef ASPRINTF_H
#define ASPRINTF_H
#ifndef vasprintf
static inline int vasprintf(char **PTR, const char *TEMPLATE, va_list AP)
{
int res;
*PTR = (char*)malloc(512);
res = vsnprintf(*PTR, 512, TEMPLATE, AP);
return res;
}
#endif
#ifndef asprintf
static inline int asprintf(char **PTR, const char *TEMPLATE, ...)
{
int res;
va_list AP;
va_start(AP, TEMPLATE);
res = vasprintf(PTR, TEMPLATE, AP);
va_end(AP);
return res;
}
#endif
#endif
|