diff options
author | Stefan Eßer <se@FreeBSD.org> | 2023-03-03 22:15:06 +0000 |
---|---|---|
committer | Stefan Eßer <se@FreeBSD.org> | 2023-03-03 22:15:06 +0000 |
commit | 0ff539eb7ca570d65a23a7ad13a91a673d89abcf (patch) | |
tree | d22a622e1a23b8541471a7a7531aa2fd9c48f937 /include/bcl.h | |
parent | 61e1a12bb6c3bfdb0a4e499c88e8eaa2b548e427 (diff) |
vendor/bc: import version 6.4.0vendor/bc/6.4.0
This version contains a fix for an issue that can affect complex
bc scripts that use multiple read() functions that receive input from
an interactive user. The same value could be returned multiple times.
Diffstat (limited to 'include/bcl.h')
-rw-r--r-- | include/bcl.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/include/bcl.h b/include/bcl.h index 253138231c66..0908e215182c 100644 --- a/include/bcl.h +++ b/include/bcl.h @@ -36,6 +36,9 @@ #ifndef BC_BCL_H #define BC_BCL_H +// TODO: Add a generation index when building with Valgrind to check for +// use-after-free's or double frees. + #include <stdbool.h> #include <stdlib.h> #include <limits.h> @@ -238,6 +241,9 @@ bcl_dup(BclNumber s); BclError bcl_bigdig(BclNumber n, BclBigDig* result); +BclError +bcl_bigdig_keep(BclNumber n, BclBigDig* result); + BclNumber bcl_bigdig2num(BclBigDig val); @@ -245,35 +251,68 @@ BclNumber bcl_add(BclNumber a, BclNumber b); BclNumber +bcl_add_keep(BclNumber a, BclNumber b); + +BclNumber bcl_sub(BclNumber a, BclNumber b); BclNumber +bcl_sub_keep(BclNumber a, BclNumber b); + +BclNumber bcl_mul(BclNumber a, BclNumber b); BclNumber +bcl_mul_keep(BclNumber a, BclNumber b); + +BclNumber bcl_div(BclNumber a, BclNumber b); BclNumber +bcl_div_keep(BclNumber a, BclNumber b); + +BclNumber bcl_mod(BclNumber a, BclNumber b); BclNumber +bcl_mod_keep(BclNumber a, BclNumber b); + +BclNumber bcl_pow(BclNumber a, BclNumber b); BclNumber +bcl_pow_keep(BclNumber a, BclNumber b); + +BclNumber bcl_lshift(BclNumber a, BclNumber b); BclNumber +bcl_lshift_keep(BclNumber a, BclNumber b); + +BclNumber bcl_rshift(BclNumber a, BclNumber b); BclNumber +bcl_rshift_keep(BclNumber a, BclNumber b); + +BclNumber bcl_sqrt(BclNumber a); +BclNumber +bcl_sqrt_keep(BclNumber a); + BclError bcl_divmod(BclNumber a, BclNumber b, BclNumber* c, BclNumber* d); +BclError +bcl_divmod_keep(BclNumber a, BclNumber b, BclNumber* c, BclNumber* d); + BclNumber bcl_modexp(BclNumber a, BclNumber b, BclNumber c); +BclNumber +bcl_modexp_keep(BclNumber a, BclNumber b, BclNumber c); + ssize_t bcl_cmp(BclNumber a, BclNumber b); @@ -289,19 +328,31 @@ bcl_parse(const char* restrict val); char* bcl_string(BclNumber n); +char* +bcl_string_keep(BclNumber n); + BclNumber bcl_irand(BclNumber a); BclNumber +bcl_irand_keep(BclNumber a); + +BclNumber bcl_frand(size_t places); BclNumber bcl_ifrand(BclNumber a, size_t places); +BclNumber +bcl_ifrand_keep(BclNumber a, size_t places); + BclError bcl_rand_seedWithNum(BclNumber n); BclError +bcl_rand_seedWithNum_keep(BclNumber n); + +BclError bcl_rand_seed(unsigned char seed[BCL_SEED_SIZE]); void |