Small code clean-up.

This commit is contained in:
LoRd_MuldeR 2022-12-01 16:53:36 +01:00
parent 80d18e0fdb
commit 19a1c2ba47
2 changed files with 11 additions and 44 deletions

View File

@ -378,14 +378,8 @@ errno_t DECLARE(hash_map_iterate)(const hash_map_t *const instance, size_t *cons
{
if (IS_VALID(instance->data, index))
{
if (key)
{
*key = instance->data.keys[index];
}
if (value)
{
*value = instance->data.values[index];
}
SAFE_SET(key, instance->data.keys[index]);
SAFE_SET(value, instance->data.values[index]);
*cursor = index + 1U;
return 0;
}
@ -407,22 +401,10 @@ errno_t DECLARE(hash_map_info)(const hash_map_t *const instance, size_t *const c
return EINVAL;
}
if (capacity)
{
*capacity = instance->data.capacity;
}
if (valid)
{
*valid = instance->valid;
}
if (deleted)
{
*deleted = instance->deleted;
}
if (limit)
{
*limit = instance->limit;
}
SAFE_SET(capacity, instance->data.capacity);
SAFE_SET(valid, instance->valid);
SAFE_SET(deleted,instance->deleted);
SAFE_SET(limit, instance->limit);
return 0;
}

View File

@ -348,10 +348,7 @@ errno_t DECLARE(hash_set_iterate)(const hash_set_t *const instance, size_t *cons
{
if (IS_VALID(instance->data, index))
{
if (item)
{
*item = instance->data.items[index];
}
SAFE_SET(item, instance->data.items[index]);
*cursor = index + 1U;
return 0;
}
@ -373,22 +370,10 @@ errno_t DECLARE(hash_set_info)(const hash_set_t *const instance, size_t *const c
return EINVAL;
}
if (capacity)
{
*capacity = instance->data.capacity;
}
if (valid)
{
*valid = instance->valid;
}
if (deleted)
{
*deleted = instance->deleted;
}
if (limit)
{
*limit = instance->limit;
}
SAFE_SET(capacity, instance->data.capacity);
SAFE_SET(valid, instance->valid);
SAFE_SET(deleted, instance->deleted);
SAFE_SET(limit, instance->limit);
return 0;
}