Skip to content

Commit

Permalink
Split up mp_rand_source.c
Browse files Browse the repository at this point in the history
In order to make `helper.pl` happy, change the ternary operator to an
if-else statement, otherwise it won't properly generate `tommath_class.h`.

This fixes #582

Signed-off-by: Steffen Jaeckel <[email protected]>
  • Loading branch information
sjaeckel committed Nov 19, 2024
1 parent 5809141 commit a6a2c3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 5 additions & 5 deletions mp_rand_source.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "tommath_private.h"
#ifdef MP_RAND_C
#ifdef MP_RAND_SOURCE_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */

mp_err(*s_mp_rand_source)(void *out, size_t size) = s_mp_rand_platform;

void mp_rand_source(mp_err(*source)(void *out, size_t size))
{
s_mp_rand_source = (source == NULL) ? s_mp_rand_platform : source;
if (source == NULL)
s_mp_rand_source = s_mp_rand_platform;
else
s_mp_rand_source = source;
}
#endif
7 changes: 7 additions & 0 deletions s_mp_rand_source.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include "tommath_private.h"
#ifdef S_MP_RAND_SOURCE_C
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */

mp_err(*s_mp_rand_source)(void *out, size_t size) = s_mp_rand_platform;
#endif

0 comments on commit a6a2c3c

Please sign in to comment.