From 13e3f6047b54d1a33d84a1b07f0e41639ac9e8a4 Mon Sep 17 00:00:00 2001 From: Leonardo Date: Tue, 12 May 2020 16:04:40 -0300 Subject: [PATCH] Minor fixes --- src/cmc/heap.h | 2 +- src/cmc/treeset.h | 8 ++++---- tests/main/src/heap.c | 2 +- tests/main/src/treeset.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cmc/heap.h b/src/cmc/heap.h index bb5caa3..0effac2 100644 --- a/src/cmc/heap.h +++ b/src/cmc/heap.h @@ -337,7 +337,7 @@ static const char *cmc_string_fmt_heap = "struct %s<%s> " \ _heap_->buffer[_heap_->count++] = value; \ \ - if (PFX##_count(_heap_) > 1) \ + if (_heap_->count > 1) \ { \ PFX##_impl_float_up(_heap_, _heap_->count - 1); \ } \ diff --git a/src/cmc/treeset.h b/src/cmc/treeset.h index f1cde3f..3bd0389 100644 --- a/src/cmc/treeset.h +++ b/src/cmc/treeset.h @@ -876,7 +876,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> " { \ /* If the cardinality of _set1_ is greater than that of _set2_ */ \ /* then it is safe to say that _set1_ can't be a subset of _set2_ */ \ - if (PFX##_count(_set1_) > PFX##_count(_set2_)) \ + if (_set1_->count > _set2_->count) \ return false; \ \ /* The empty set is a subset of all sets */ \ @@ -915,7 +915,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> " /* If the cardinality of _set1_ is greater than or equal to that */ \ /* of _set2_, then it is safe to say that _set1_ can't be a proper */ \ /* subset of _set2_ */ \ - if (PFX##_count(_set1_) >= PFX##_count(_set2_)) \ + if (_set1_->count >= _set2_->count) \ return false; \ \ if (PFX##_empty(_set1_)) \ @@ -1145,7 +1145,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> " return false; \ } \ \ - if (steps == 0 || iter->index + steps >= PFX##_count(iter->target)) \ + if (steps == 0 || iter->index + steps >= iter->target->count) \ return false; \ \ iter->index += steps; \ @@ -1183,7 +1183,7 @@ static const char *cmc_string_fmt_treeset = "struct %s<%s> " /* given index */ \ bool PFX##_iter_go_to(struct SNAME##_iter *iter, size_t index) \ { \ - if (index >= PFX##_count(iter->target)) \ + if (index >= iter->target->count) \ return false; \ \ if (iter->index > index) \ diff --git a/tests/main/src/heap.c b/tests/main/src/heap.c index 2ff27d2..87d59c8 100644 --- a/tests/main/src/heap.c +++ b/tests/main/src/heap.c @@ -166,7 +166,7 @@ _Bool h_insert(struct heap *_heap_, size_t value) return 0; } _heap_->buffer[_heap_->count++] = value; - if (h_count(_heap_) > 1) + if (_heap_->count > 1) { h_impl_float_up(_heap_, _heap_->count - 1); } diff --git a/tests/main/src/treeset.c b/tests/main/src/treeset.c index e9eec3a..1d60900 100644 --- a/tests/main/src/treeset.c +++ b/tests/main/src/treeset.c @@ -585,7 +585,7 @@ struct treeset *ts_symmetric_difference(struct treeset *_set1_, } _Bool ts_is_subset(struct treeset *_set1_, struct treeset *_set2_) { - if (ts_count(_set1_) > ts_count(_set2_)) + if (_set1_->count > _set2_->count) return 0; if (ts_empty(_set1_)) return 1; @@ -605,7 +605,7 @@ _Bool ts_is_superset(struct treeset *_set1_, struct treeset *_set2_) } _Bool ts_is_proper_subset(struct treeset *_set1_, struct treeset *_set2_) { - if (ts_count(_set1_) >= ts_count(_set2_)) + if (_set1_->count >= _set2_->count) return 0; if (ts_empty(_set1_)) { @@ -767,7 +767,7 @@ _Bool ts_iter_advance(struct treeset_iter *iter, size_t steps) iter->end = 1; return 0; } - if (steps == 0 || iter->index + steps >= ts_count(iter->target)) + if (steps == 0 || iter->index + steps >= iter->target->count) return 0; iter->index += steps; for (size_t i = 0; i < steps; i++) @@ -792,7 +792,7 @@ _Bool ts_iter_rewind(struct treeset_iter *iter, size_t steps) } _Bool ts_iter_go_to(struct treeset_iter *iter, size_t index) { - if (index >= ts_count(iter->target)) + if (index >= iter->target->count) return 0; if (iter->index > index) return ts_iter_rewind(iter, iter->index - index);