diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-23 20:28:11 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2019-10-23 20:28:11 (GMT) |
commit | a1e06f4b0acd63c93d68837e05a0d3d1fa1f0281 (patch) | |
tree | 2f184f7f806b9d5e0e8deff6a58ecffd3c1328d1 /generic/tclStubInit.c | |
parent | 2df6f12a996d019b78a31c15f5875e2609fb28b2 (diff) | |
download | tcl-a1e06f4b0acd63c93d68837e05a0d3d1fa1f0281.zip tcl-a1e06f4b0acd63c93d68837e05a0d3d1fa1f0281.tar.gz tcl-a1e06f4b0acd63c93d68837e05a0d3d1fa1f0281.tar.bz2 |
Combine two libtommath stub entries, which do exactly the same.
Fix mp_init_set_int stub, handling the situation that mp_init() fails (however unlikely)
Diffstat (limited to 'generic/tclStubInit.c')
-rw-r--r-- | generic/tclStubInit.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/generic/tclStubInit.c b/generic/tclStubInit.c index ce389bf..d1911d7 100644 --- a/generic/tclStubInit.c +++ b/generic/tclStubInit.c @@ -73,21 +73,19 @@ static int TclSockMinimumBuffersOld(int sock, int size) static MP_SET_UNSIGNED(bn_mp_set_ull, Tcl_WideUInt) -mp_err TclBN_mp_set_long(mp_int *a, unsigned long i) +mp_err TclBN_mp_set_int(mp_int *a, unsigned long i) { bn_mp_set_ull(a, i); return MP_OKAY; } -mp_err TclBN_mp_set_int(mp_int *a, unsigned long i) -{ - return TclBN_mp_set_long(a, i); -} - mp_err TclBN_mp_init_set_int(mp_int *a, unsigned long i) { - mp_init(a); - return TclBN_mp_set_long(a, i); + mp_err result = mp_init(a); + if (result == MP_OKAY) { + bn_mp_set_ull(a, i); + } + return result; } int TclBN_mp_expt_d_ex(const mp_int *a, mp_digit b, mp_int *c, int fast) @@ -922,7 +920,7 @@ const TclTomMathStubs tclTomMathStubs = { TclBN_mp_expt_d_ex, /* 67 */ 0, /* 68 */ 0, /* 69 */ - TclBN_mp_set_long, /* 70 */ + 0, /* 70 */ 0, /* 71 */ TclBN_mp_isodd, /* 72 */ TclBN_mp_tc_and, /* 73 */ |