Lines 79-84
Link Here
|
79 |
return cp; |
79 |
return cp; |
80 |
} |
80 |
} |
81 |
|
81 |
|
|
|
82 |
static inline int myvasprintf(char **PTR, const char *TEMPLATE, va_list AP) |
83 |
{ |
84 |
int res; |
85 |
char buf[16000]; |
86 |
res = vsnprintf(buf, 16000, TEMPLATE, AP); |
87 |
if (res > 0) { |
88 |
*PTR = (char*)malloc(res + 1); |
89 |
res = vsnprintf(*PTR, res + 1, TEMPLATE, AP); |
90 |
} |
91 |
return res; |
92 |
} |
93 |
|
82 |
int |
94 |
int |
83 |
xasprintf(char **ret, const char *fmt, ...) |
95 |
xasprintf(char **ret, const char *fmt, ...) |
84 |
{ |
96 |
{ |
Lines 86-92
Link Here
|
86 |
int i; |
98 |
int i; |
87 |
|
99 |
|
88 |
va_start(ap, fmt); |
100 |
va_start(ap, fmt); |
89 |
i = vasprintf(ret, fmt, ap); |
101 |
i = myvasprintf(ret, fmt, ap); |
90 |
va_end(ap); |
102 |
va_end(ap); |
91 |
|
103 |
|
92 |
if (i < 0 || *ret == NULL) |
104 |
if (i < 0 || *ret == NULL) |