refactor without err initialization
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/bn_mp_decr.c b/bn_mp_decr.c
index 7e8c2ea..c6a1572 100644
--- a/bn_mp_decr.c
+++ b/bn_mp_decr.c
@@ -6,12 +6,12 @@
/* Decrement "a" by one like "a--". Changes input! */
mp_err mp_decr(mp_int *a)
{
- mp_err err = MP_OKAY;
if (MP_IS_ZERO(a)) {
mp_set(a,1uL);
a->sign = MP_NEG;
return MP_OKAY;
} else if (a->sign == MP_NEG) {
+ mp_err err;
a->sign = MP_ZPOS;
if ((err = mp_incr(a)) != MP_OKAY) {
return err;
diff --git a/bn_mp_incr.c b/bn_mp_incr.c
index d72a5b4..5d0039e 100644
--- a/bn_mp_incr.c
+++ b/bn_mp_incr.c
@@ -6,11 +6,11 @@
/* Increment "a" by one like "a++". Changes input! */
mp_err mp_incr(mp_int *a)
{
- mp_err err = MP_OKAY;
if (MP_IS_ZERO(a)) {
mp_set(a,1uL);
return MP_OKAY;
} else if (a->sign == MP_NEG) {
+ mp_err err;
a->sign = MP_ZPOS;
if ((err = mp_decr(a)) != MP_OKAY) {
return err;
diff --git a/bn_mp_kronecker.c b/bn_mp_kronecker.c
index f6b33cd..8245e84 100644
--- a/bn_mp_kronecker.c
+++ b/bn_mp_kronecker.c
@@ -20,7 +20,7 @@
mp_err mp_kronecker(const mp_int *a, const mp_int *p, int *c)
{
mp_int a1, p1, r;
- mp_err err = MP_OKAY;
+ mp_err err;
int v, k;
static const int table[8] = {0, 1, 0, -1, 0, -1, 0, 1};
@@ -28,16 +28,15 @@ mp_err mp_kronecker(const mp_int *a, const mp_int *p, int *c)
if (MP_IS_ZERO(p)) {
if ((a->used == 1) && (a->dp[0] == 1u)) {
*c = 1;
- return err;
} else {
*c = 0;
- return err;
}
+ return MP_OKAY;
}
if (MP_IS_EVEN(a) && MP_IS_EVEN(p)) {
*c = 0;
- return err;
+ return MP_OKAY;
}
if ((err = mp_init_copy(&a1, a)) != MP_OKAY) {