Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100644
|
File size:
382 bytes
|
Line | |
---|
1 | /* |
---|
2 | * vasprintf.c |
---|
3 | */ |
---|
4 | |
---|
5 | #include <stdio.h> |
---|
6 | #include <stdlib.h> |
---|
7 | #include <stdarg.h> |
---|
8 | |
---|
9 | int vasprintf(char **bufp, const char *format, va_list ap) |
---|
10 | { |
---|
11 | va_list ap1; |
---|
12 | int bytes; |
---|
13 | char *p; |
---|
14 | |
---|
15 | va_copy(ap1, ap); |
---|
16 | |
---|
17 | bytes = vsnprintf(NULL, 0, format, ap1) + 1; |
---|
18 | va_end(ap1); |
---|
19 | |
---|
20 | *bufp = p = malloc(bytes); |
---|
21 | if (!p) |
---|
22 | return -1; |
---|
23 | |
---|
24 | return vsnprintf(p, bytes, format, ap); |
---|
25 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.