repo.or.cz
/
syslinux-debian
/
hramrach.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git]
/
com32
/
lib
/
asprintf.c
blob
6b1b4ff509e8d9d03b723b0f4c3191cdcecfa9c5
1
/*
2
* asprintf.c
3
*/
4
5
#include <stdio.h>
6
#include <stdlib.h>
7
#include <stdarg.h>
8
9
int
asprintf
(
char
**
bufp
,
const char
*
format
, ...)
10
{
11
va_list
ap
,
ap1
;
12
int
rv
;
13
int
bytes
;
14
char
*
p
;
15
16
va_start
(
ap
,
format
);
17
va_copy
(
ap1
,
ap
);
18
19
bytes
=
vsnprintf
(
NULL
,
0
,
format
,
ap1
) +
1
;
20
va_end
(
ap1
);
21
22
*
bufp
=
p
=
malloc
(
bytes
);
23
if
( !
p
)
24
return
-
1
;
25
26
rv
=
vsnprintf
(
p
,
bytes
,
format
,
ap
);
27
va_end
(
ap
);
28
29
return
rv
;
30
}