summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrbuj <[email protected]>2020-04-08 00:28:21 +0200
committerZenWalker <[email protected]>2020-04-09 03:00:29 +0200
commit4bd2bd7da99284a4baa9cd5543cb04170dde9803 (patch)
treef6d9e82e68e1893620597a837a9057eb28b97fa4
parent8856b8a7812a5e555b3731e61e385ea40b49a219 (diff)
downloadmate-calc-4bd2bd7da99284a4baa9cd5543cb04170dde9803.tar.bz2
mate-calc-4bd2bd7da99284a4baa9cd5543cb04170dde9803.tar.xz
Use only one mp_clear statement per line
-rw-r--r--src/financial.c42
-rw-r--r--src/mp-serializer.c14
-rw-r--r--src/mp.c5
-rw-r--r--src/test-mp.c4
-rw-r--r--src/unittest.c4
5 files changed, 54 insertions, 15 deletions
diff --git a/src/financial.c b/src/financial.c
index 9552cc1..337ff93 100644
--- a/src/financial.c
+++ b/src/financial.c
@@ -35,7 +35,10 @@ calc_ctrm(MathEquation *equation, MPNumber *t, MPNumber *pint, MPNumber *fv, MPN
mp_ln(&MP3, &MP4);
mp_divide(&MP2, &MP4, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
@@ -78,7 +81,9 @@ calc_ddb(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *life, MP
mp_set_from_integer(0, t);
}
- mp_clear(&MPbv); mp_clear(&MP1); mp_clear(&MP2);
+ mp_clear(&MPbv);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
}
@@ -104,7 +109,10 @@ calc_fv(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNu
mp_multiply(pmt, &MP3, &MP4);
mp_divide(&MP4, pint, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
@@ -125,7 +133,8 @@ calc_gpm(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *margin)
mp_subtract(&MP1, margin, &MP2);
mp_divide(cost, &MP2, t);
- mp_clear(&MP1); mp_clear(&MP2);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
}
@@ -153,7 +162,10 @@ calc_pmt(MathEquation *equation, MPNumber *t, MPNumber *prin, MPNumber *pint, MP
mp_divide(pint, &MP1, &MP2);
mp_multiply(prin, &MP2, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
@@ -181,7 +193,10 @@ calc_pv(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *pint, MPNu
mp_divide(&MP1, pint, &MP2);
mp_multiply(pmt, &MP2, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
@@ -207,7 +222,10 @@ calc_rate(MathEquation *equation, MPNumber *t, MPNumber *fv, MPNumber *pv, MPNum
mp_xpowy(&MP1, &MP3, &MP4);
mp_add_integer(&MP4, -1, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
@@ -257,7 +275,10 @@ calc_syd(MathEquation *equation, MPNumber *t, MPNumber *cost, MPNumber *salvage,
mp_subtract(cost, salvage, &MP1);
mp_multiply(&MP1, &MP2, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
@@ -285,7 +306,10 @@ calc_term(MathEquation *equation, MPNumber *t, MPNumber *pmt, MPNumber *fv, MPNu
mp_ln(&MP4, &MP1);
mp_divide(&MP1, &MP2, t);
- mp_clear(&MP1); mp_clear(&MP2); mp_clear(&MP3); mp_clear(&MP4);
+ mp_clear(&MP1);
+ mp_clear(&MP2);
+ mp_clear(&MP3);
+ mp_clear(&MP4);
}
diff --git a/src/mp-serializer.c b/src/mp-serializer.c
index 58f9030..896c843 100644
--- a/src/mp-serializer.c
+++ b/src/mp-serializer.c
@@ -173,7 +173,9 @@ mp_to_string_real(MpSerializer *serializer, const MPNumber *x, int base, gboolea
b -= d * multiplier;
}
}
- mp_clear(&number); mp_clear(&integer_component); mp_clear(&fractional_component);
+ mp_clear(&number);
+ mp_clear(&integer_component);
+ mp_clear(&fractional_component);
mp_clear(&temp);
}
@@ -289,8 +291,14 @@ mp_to_exponential_string_real(MpSerializer *serializer, const MPNumber *x, GStri
fixed = mp_to_string(serializer, &mantissa, n_digits);
g_string_append(string, fixed);
g_free(fixed);
- mp_clear(&t); mp_clear(&z); mp_clear(&base); mp_clear(&base3);
- mp_clear(&base10); mp_clear(&base10inv); mp_clear(&mantissa);
+
+ mp_clear(&t);
+ mp_clear(&z);
+ mp_clear(&base);
+ mp_clear(&base3);
+ mp_clear(&base10);
+ mp_clear(&base10inv);
+ mp_clear(&mantissa);
return exponent;
}
diff --git a/src/mp.c b/src/mp.c
index d7fcc75..30f69f4 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -764,7 +764,10 @@ mp_factorize(const MPNumber *x)
mp_invert_sign(list->data, list->data);
/* MPNumbers in GList will be freed in math_equation_factorize_real */
- mp_clear(&value); mp_clear(&tmp); mp_clear(&divisor); mp_clear(&root);
+ mp_clear(&value);
+ mp_clear(&tmp);
+ mp_clear(&divisor);
+ mp_clear(&root);
return list;
}
diff --git a/src/test-mp.c b/src/test-mp.c
index 14edadd..c66185c 100644
--- a/src/test-mp.c
+++ b/src/test-mp.c
@@ -214,7 +214,9 @@ test_mp(void)
try("mp_is_less_equal(-1, 0)", mp_is_less_equal (&minus_one, &zero), true);
try("mp_is_less_equal(-1, 1)", mp_is_less_equal (&minus_one, &one), true);
- mp_clear(&zero); mp_clear(&one); mp_clear(&minus_one);
+ mp_clear(&zero);
+ mp_clear(&one);
+ mp_clear(&minus_one);
}
diff --git a/src/unittest.c b/src/unittest.c
index ffe114a..5039115 100644
--- a/src/unittest.c
+++ b/src/unittest.c
@@ -750,7 +750,9 @@ static void test_mp()
try("mp_is_less_equal(-1, 0)", mp_is_less_equal (&minus_one, &zero), true);
try("mp_is_less_equal(-1, 1)", mp_is_less_equal (&minus_one, &one), true);
- mp_clear(&zero); mp_clear(&one); mp_clear(&minus_one);
+ mp_clear(&zero);
+ mp_clear(&one);
+ mp_clear(&minus_one);
}