Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
a06b1b4d
Commit
a06b1b4d
authored
Oct 05, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Solaris does not have vasnprintf()
parent
d28b45fd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
configure.ac
configure.ac
+1
-0
libasn1common/asn1_buffer.c
libasn1common/asn1_buffer.c
+35
-0
No files found.
configure.ac
View file @
a06b1b4d
...
...
@@ -244,6 +244,7 @@ AC_CHECK_FUNCS(mergesort)
AC_CHECK_FUNCS(mkstemps)
AC_CHECK_FUNCS(timegm)
AC_CHECK_DECLS(alloca strcasecmp)
AC_CHECK_DECLS(vasprintf)
AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])])
dnl Use pandoc to generate manual pages.
...
...
libasn1common/asn1_buffer.c
View file @
a06b1b4d
...
...
@@ -5,9 +5,14 @@
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "config.h"
#include "asn1_buffer.h"
#ifndef HAVE_DECL_VASPRINTF
int
vasprintf
(
char
**
ret
,
const
char
*
fmt
,
va_list
args
);
#endif
/*
* Create and destroy the buffer.
*/
...
...
@@ -134,3 +139,33 @@ int abuf_vprintf(abuf *ab, const char *fmt, va_list ap) {
return
ret
;
}
#ifndef HAVE_DECL_VASPRINTF
/* Solaris doesn't have vasprintf(3). */
int
vasprintf
(
char
**
ret
,
const
char
*
fmt
,
va_list
args
)
{
int
actual_length
=
-
1
;
va_list
copy
;
va_copy
(
copy
,
args
);
int
suggested
=
vsnprintf
(
NULL
,
0
,
fmt
,
args
);
if
(
suggested
>=
0
)
{
*
ret
=
malloc
(
suggested
+
1
);
if
(
*
ret
)
{
int
actual_length
=
vsnprintf
(
*
ret
,
suggested
+
1
,
fmt
,
copy
);
if
(
actual_length
>=
0
)
{
assert
(
actual_length
==
suggested
);
assert
((
*
ret
)[
actual_length
]
==
'\0'
);
}
else
{
free
(
*
ret
);
*
ret
=
0
;
}
}
}
else
{
*
ret
=
NULL
;
assert
(
suggested
>=
0
);
/* Can't function like this */
}
va_end
(
args
);
return
actual_length
;
}
#endif
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