Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
LSH
lsh
Commits
64b694a5
Commit
64b694a5
authored
Nov 27, 2000
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* src/argp/argp-test.c: Fixed asprintf implementation.
Rev: src/argp/argp-test.c:1.3
parent
23c4f27e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
src/argp/argp-test.c
src/argp/argp-test.c
+15
-8
No files found.
src/argp/argp-test.c
View file @
64b694a5
...
...
@@ -42,12 +42,16 @@
#endif
#if !HAVE_ASPRINTF
int
asprintf
(
char
**
result
,
const
char
*
format
,
...)
#include <stdarg.h>
static
int
asprintf
(
char
**
result
,
const
char
*
format
,
...)
{
size_t
size
=
200
;
char
*
p
=
NULL
;
size_t
size
;
char
*
p
;
do
{
for
(
size
=
200
,
p
=
NULL
;;
size
*=
2
)
{
va_list
args
;
int
written
;
...
...
@@ -61,12 +65,15 @@ int asprintf (char **result, const char *format, ...)
p
[
size
]
=
'\0'
;
va_start
(
args
,
format
);
written
=
vsnprintf
(
format
,
size
,
args
);
written
=
vsnprintf
(
p
,
format
,
size
,
args
);
va_end
(
args
);
}
while
(
written
<
0
);
*
result
=
p
;
if
(
written
>=
0
)
{
*
result
=
p
;
return
written
;
}
}
}
#endif
/* !HAVE_ASPRINTF */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment