summaryrefslogtreecommitdiff
path: root/src/math-variables.c
diff options
context:
space:
mode:
authormbkma <[email protected]>2020-03-05 13:06:45 +0100
committerraveit65 <[email protected]>2020-03-08 21:40:41 +0100
commitb0117b1d5ae73916c6f0d289be1f693bb5f46824 (patch)
tree4751c73751ed9951ae5a1c5b93f04c84593c6974 /src/math-variables.c
parent91962719d06ce16d8bc3523872b83fae4d151e10 (diff)
downloadmate-calc-b0117b1d5ae73916c6f0d289be1f693bb5f46824.tar.bz2
mate-calc-b0117b1d5ae73916c6f0d289be1f693bb5f46824.tar.xz
Port to GNU MPFR/MPC Library
For further information please visit: https://www.mpfr.org/ http://www.multiprecision.org/mpc
Diffstat (limited to 'src/math-variables.c')
-rw-r--r--src/math-variables.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/math-variables.c b/src/math-variables.c
index 225ca9c..b44b387 100644
--- a/src/math-variables.c
+++ b/src/math-variables.c
@@ -59,10 +59,14 @@ registers_load(MathVariables *variables)
value = g_strstrip(value);
t = g_malloc(sizeof(MPNumber));
+ *t = mp_new();
if (mp_set_from_string(value, 10, t) == 0)
g_hash_table_insert(variables->priv->registers, g_strdup(name), t);
else
+ {
+ mp_clear(t);
g_free(t);
+ }
}
fclose(f);
}
@@ -135,6 +139,7 @@ math_variables_set(MathVariables *variables, const char *name, const MPNumber *v
g_return_if_fail(value != NULL);
t = g_malloc(sizeof(MPNumber));
+ *t = mp_new();
mp_set_from_mp(value, t);
g_hash_table_insert(variables->priv->registers, g_strdup(name), t);
registers_save(variables);