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
3ed670b2
Commit
3ed670b2
authored
Sep 03, 2020
by
Evgeniy Isaev
Committed by
Mouse
Sep 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check for `random()` function availability
parent
276c959b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
0 deletions
+5
-0
configure.ac
configure.ac
+1
-0
skeletons/asn_random_fill.c
skeletons/asn_random_fill.c
+4
-0
No files found.
configure.ac
View file @
3ed670b2
...
@@ -285,6 +285,7 @@ AC_CHECK_FUNCS(strtoimax strtoll)
...
@@ -285,6 +285,7 @@ AC_CHECK_FUNCS(strtoimax strtoll)
AC_CHECK_FUNCS(mergesort)
AC_CHECK_FUNCS(mergesort)
AC_CHECK_FUNCS(mkstemps)
AC_CHECK_FUNCS(mkstemps)
AC_CHECK_FUNCS(timegm)
AC_CHECK_FUNCS(timegm)
AC_CHECK_FUNCS(random)
AC_CHECK_DECLS(strcasecmp)
AC_CHECK_DECLS(strcasecmp)
AC_CHECK_DECLS(vasprintf)
AC_CHECK_DECLS(vasprintf)
AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])])
AC_TRY_LINK_FUNC([symlink],[AC_DEFINE([HAVE_SYMLINK], 1, [Define to 1 if you have the symlink function.])])
...
...
skeletons/asn_random_fill.c
View file @
3ed670b2
...
@@ -49,7 +49,11 @@ asn_random_between(intmax_t lb, intmax_t rb) {
...
@@ -49,7 +49,11 @@ asn_random_between(intmax_t lb, intmax_t rb) {
for
(;
got_entropy
<
range
;)
{
for
(;
got_entropy
<
range
;)
{
got_entropy
=
(
got_entropy
<<
24
)
|
0xffffff
;
got_entropy
=
(
got_entropy
<<
24
)
|
0xffffff
;
#ifdef HAVE_RANDOM
value
=
(
value
<<
24
)
|
(
random
()
%
0xffffff
);
value
=
(
value
<<
24
)
|
(
random
()
%
0xffffff
);
#else
value
=
(
value
<<
24
)
|
(
rand
()
%
0xffffff
);
#endif
}
}
return
lb
+
(
intmax_t
)(
value
%
(
range
+
1
));
return
lb
+
(
intmax_t
)(
value
%
(
range
+
1
));
...
...
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