From 48abe78e51e9a51fba8b93ff7faa32a14a2aa50c Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 6 Jun 2017 20:28:37 +1200 Subject: [PATCH] Remove redundant `= 0` initialisations --- src/key.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/key.cpp b/src/key.cpp index 3b679414d..3a93187d7 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -35,8 +35,6 @@ static secp256k1_context* secp256k1_context_sign = NULL; */ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) { const unsigned char *end = privkey + privkeylen; - size_t lenb = 0; - size_t len = 0; memset(out32, 0, 32); /* sequence header */ if (end - privkey < 1 || *privkey != 0x30u) { @@ -47,7 +45,7 @@ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *ou if (end - privkey < 1 || !(*privkey & 0x80u)) { return 0; } - lenb = *privkey & ~0x80u; privkey++; + size_t lenb = *privkey & ~0x80u; privkey++; if (lenb < 1 || lenb > 2) { return 0; } @@ -55,7 +53,7 @@ static int ec_privkey_import_der(const secp256k1_context* ctx, unsigned char *ou return 0; } /* sequence length */ - len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0u); + size_t len = privkey[lenb-1] | (lenb > 1 ? privkey[lenb-2] << 8 : 0u); privkey += lenb; if (end - privkey < len) { return 0;