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
ed93977d
Commit
ed93977d
authored
Oct 08, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
internal implementation file
parent
d20f1746
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
0 deletions
+47
-0
skeletons/asn_internal.c
skeletons/asn_internal.c
+47
-0
No files found.
skeletons/asn_internal.c
0 → 100644
View file @
ed93977d
#include <asn_internal.h>
ssize_t
asn__format_to_callback
(
int
(
*
cb
)(
const
void
*
,
size_t
,
void
*
key
),
void
*
key
,
const
char
*
fmt
,
...)
{
char
scratch
[
64
];
char
*
buf
=
scratch
;
size_t
buf_size
=
sizeof
(
scratch
);
int
wrote
;
int
cb_ret
;
do
{
va_list
args
;
va_start
(
args
,
fmt
);
wrote
=
vsnprintf
(
buf
,
buf_size
,
fmt
,
args
);
if
(
wrote
<
(
ssize_t
)
buf_size
)
{
if
(
wrote
<
0
)
{
if
(
buf
!=
scratch
)
FREEMEM
(
buf
);
return
-
1
;
}
break
;
}
buf_size
<<=
1
;
if
(
buf
==
scratch
)
{
buf
=
MALLOC
(
buf_size
);
if
(
!
buf
)
return
-
1
;
}
else
{
void
*
p
=
REALLOC
(
buf
,
buf_size
);
if
(
!
p
)
{
FREEMEM
(
buf
);
return
-
1
;
}
buf
=
p
;
}
}
while
(
1
);
cb_ret
=
cb
(
buf
,
wrote
,
key
);
if
(
buf
!=
scratch
)
FREEMEM
(
buf
);
if
(
cb_ret
<
0
)
{
return
-
1
;
}
return
wrote
;
}
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