From 9788147270ebab0c698e1f8cb066fbda56de90c2 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Tue, 29 Dec 2015 18:40:48 +0100 Subject: [PATCH] Require less indentation --- .../crypto_pwhash/argon2/argon2-core.c | 41 +++++++++---------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/src/libsodium/crypto_pwhash/argon2/argon2-core.c b/src/libsodium/crypto_pwhash/argon2/argon2-core.c index 556ab821..aced92bd 100644 --- a/src/libsodium/crypto_pwhash/argon2/argon2-core.c +++ b/src/libsodium/crypto_pwhash/argon2/argon2-core.c @@ -66,30 +66,29 @@ static void store_block(void *output, const block *src) { /***************Memory allocators*****************/ int allocate_memory(block_region **region, uint32_t m_cost) { - if (region != NULL) { - block *memory; - size_t memory_size = sizeof(block) * m_cost; + block *memory; + size_t memory_size; - if (m_cost == 0 || - memory_size / m_cost != - sizeof(block)) { /*1. Check for multiplication overflow*/ - return ARGON2_MEMORY_ALLOCATION_ERROR; - } - *region = (block_region *)malloc(sizeof(block_region)); /*2. Try to allocate region*/ - if (!*region) { - return ARGON2_MEMORY_ALLOCATION_ERROR; - } - - memory = (block *)malloc(memory_size); /*3. Try to allocate block*/ - if (!memory) { - return ARGON2_MEMORY_ALLOCATION_ERROR; - } - (*region)->memory = memory; - - return ARGON2_OK; - } else { + if (region == NULL) { return ARGON2_MEMORY_ALLOCATION_ERROR; } + memory_size = sizeof(block) * m_cost; + if (m_cost == 0 || + memory_size / m_cost != sizeof(block)) { /*1. Check for multiplication overflow*/ + return ARGON2_MEMORY_ALLOCATION_ERROR; + } + *region = (block_region *)malloc(sizeof(block_region)); /*2. Try to allocate region*/ + if (!*region) { + return ARGON2_MEMORY_ALLOCATION_ERROR; + } + + memory = (block *)malloc(memory_size); /*3. Try to allocate block*/ + if (!memory) { + return ARGON2_MEMORY_ALLOCATION_ERROR; + } + (*region)->memory = memory; + + return ARGON2_OK; } /*********Memory functions*/