Require less indentation

This commit is contained in:
Frank Denis 2015-12-29 18:40:48 +01:00
parent 9ef45f8456
commit 9788147270

View File

@ -66,13 +66,15 @@ 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;
size_t memory_size;
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*/
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*/
@ -87,9 +89,6 @@ int allocate_memory(block_region **region, uint32_t m_cost) {
(*region)->memory = memory;
return ARGON2_OK;
} else {
return ARGON2_MEMORY_ALLOCATION_ERROR;
}
}
/*********Memory functions*/