From 57b1cc9c1969b1e1b684924b42b0018f567d63d9 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Wed, 9 Sep 2020 10:31:23 +0200 Subject: Removed assumptions about clist iterators. --- stc/clist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stc/clist.h b/stc/clist.h index 388c7e8e..dfb88db4 100644 --- a/stc/clist.h +++ b/stc/clist.h @@ -245,7 +245,7 @@ STC_API size_t _clist_size(const clist_void* self); STC_API clist_##X##_iter_t \ clist_##X##_find(const clist_##X* self, RawValue val) { \ clist_##X##_iter_t it = clist_##X##_find_before(self, clist_##X##_before_begin(self), clist_##X##_end(self), val); \ - if (it.item) it.item = it.item->next; \ + if (it.item != clist_##X##_end(self).item) clist_##X##_next(&it); \ return it; \ } \ \ @@ -253,7 +253,7 @@ STC_API size_t _clist_size(const clist_void* self); clist_##X##_remove(clist_##X* self, RawValue val) { \ size_t n = 0; \ clist_##X##_iter_t it = clist_##X##_before_begin(self), end = clist_##X##_end(self); \ - while ((it = clist_##X##_find_before(self, it, end, val)).item != end.item) \ + while ((it = clist_##X##_find_before(self, it, clist_##X##_end(self), val)).item != clist_##X##_end(self).item) \ clist_##X##_erase_after(self, it), ++n; \ return n; \ } \ -- cgit v1.2.3