From ecc0b51e4b9248ce8beed1e6492afce4859c917f Mon Sep 17 00:00:00 2001 From: Leonardo Date: Mon, 2 Mar 2020 22:50:07 -0300 Subject: [PATCH] Removing CMC_FOR_EACH and CMC_FOR_EACH_REV and small fix to multiset --- src/cmc/multiset.h | 4 ++-- src/utl/foreach.h | 20 -------------------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/src/cmc/multiset.h b/src/cmc/multiset.h index bcdbbbb..0cd77cd 100644 --- a/src/cmc/multiset.h +++ b/src/cmc/multiset.h @@ -772,8 +772,8 @@ struct cmc_callbacks_multiset struct SNAME *PFX##_copy_of(struct SNAME *_set_) \ { \ struct SNAME *result = \ - PFX##_new_custom(_set_->capacity, _set_->load, _set_->f_val, \ - _set_->alloc, _set_->callbacks); \ + PFX##_new_custom(_set_->capacity * _set_->load, _set_->load, \ + _set_->f_val, _set_->alloc, _set_->callbacks); \ \ if (!result) \ return NULL; \ diff --git a/src/utl/foreach.h b/src/utl/foreach.h index 8d57a22..11362cd 100644 --- a/src/utl/foreach.h +++ b/src/utl/foreach.h @@ -11,26 +11,6 @@ #ifndef CMC_FOR_EACH_H #define CMC_FOR_EACH_H -#define CMC_FOR_EACH(PFX, SNAME, TARGET, BODY) \ - do \ - { \ - for (struct SNAME##_iter iter = (TARGET)->it_start(TARGET); \ - !PFX##_iter_end(&iter); PFX##_iter_next(&iter)) \ - { \ - BODY; \ - } \ - } while (0) - -#define CMC_FOR_EACH_REV(PFX, SNAME, TARGET, BODY) \ - do \ - { \ - for (struct SNAME##_iter iter = (TARGET)->it_end(TARGET); \ - !PFX##_iter_start(&iter); PFX##_iter_prev(&iter)) \ - { \ - BODY; \ - } \ - } while (0) - #define CMC_FOREACH(PFX, SNAME, ITERNAME, TARGET) \ for (struct SNAME##_iter ITERNAME = (TARGET)->it_start(TARGET); \ !PFX##_iter_end(&ITERNAME); PFX##_iter_next(&ITERNAME))