From 0c8e12ce30dbd8d5ba17c2782aaf4d09de809168 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Thu, 12 Mar 2020 11:58:02 -0300 Subject: [PATCH] Renaming some ERROR flags to INVALID --- src/cmc/bidimap.h | 2 +- src/cmc/hashmap.h | 2 +- src/cmc/hashset.h | 2 +- src/cmc/heap.h | 2 +- src/cmc/intervalheap.h | 7 +++++++ src/cmc/multimap.h | 2 +- 6 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/cmc/bidimap.h b/src/cmc/bidimap.h index ee4a52e..cc66251 100644 --- a/src/cmc/bidimap.h +++ b/src/cmc/bidimap.h @@ -959,7 +959,7 @@ struct cmc_callbacks_bidimap /* Not possible to shrink with current available prime numbers */ \ if (new_cap < _map_->count / _map_->load) \ { \ - _map_->flag = cmc_flags.ERROR; \ + _map_->flag = cmc_flags.INVALID; \ return false; \ } \ \ diff --git a/src/cmc/hashmap.h b/src/cmc/hashmap.h index b225e38..382b03d 100644 --- a/src/cmc/hashmap.h +++ b/src/cmc/hashmap.h @@ -832,7 +832,7 @@ struct cmc_callbacks_hashmap /* Not possible to shrink with current available prime numbers */ \ if (theoretical_size < _map_->count / _map_->load) \ { \ - _map_->flag = cmc_flags.ERROR; \ + _map_->flag = cmc_flags.INVALID; \ return false; \ } \ \ diff --git a/src/cmc/hashset.h b/src/cmc/hashset.h index 00006d2..91d0533 100644 --- a/src/cmc/hashset.h +++ b/src/cmc/hashset.h @@ -713,7 +713,7 @@ struct cmc_callbacks_hashset /* Not possible to shrink with current available prime numbers */ \ if (theoretical_size < _set_->count / _set_->load) \ { \ - _set_->flag = cmc_flags.ERROR; \ + _set_->flag = cmc_flags.INVALID; \ return false; \ } \ \ diff --git a/src/cmc/heap.h b/src/cmc/heap.h index 8aff2b3..012257f 100644 --- a/src/cmc/heap.h +++ b/src/cmc/heap.h @@ -523,7 +523,7 @@ struct cmc_callbacks_heap \ if (capacity < _heap_->count) \ { \ - _heap_->flag = cmc_flags.ERROR; \ + _heap_->flag = cmc_flags.INVALID; \ return false; \ } \ \ diff --git a/src/cmc/intervalheap.h b/src/cmc/intervalheap.h index 5527e98..2c02201 100644 --- a/src/cmc/intervalheap.h +++ b/src/cmc/intervalheap.h @@ -706,6 +706,13 @@ struct cmc_callbacks_intervalheap return true; \ \ if (capacity < _heap_->count) \ + { \ + _heap_->flag = cmc_flags.INVALID; \ + return false; \ + } \ + \ + /* Prevent overflow */ \ + if (capacity == UINTMAX_MAX) \ { \ _heap_->flag = cmc_flags.ERROR; \ return false; \ diff --git a/src/cmc/multimap.h b/src/cmc/multimap.h index 5c29624..68ce834 100644 --- a/src/cmc/multimap.h +++ b/src/cmc/multimap.h @@ -1078,7 +1078,7 @@ struct cmc_callbacks_multimap /* Not possible to shrink with current available prime numbers */ \ if (theoretical_size < _map_->count / _map_->load) \ { \ - _map_->flag = cmc_flags.ERROR; \ + _map_->flag = cmc_flags.INVALID; \ return false; \ } \ \