diff options
| author | Tyge Løvset <[email protected]> | 2020-09-09 10:31:23 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-09-09 10:31:23 +0200 |
| commit | 57b1cc9c1969b1e1b684924b42b0018f567d63d9 (patch) | |
| tree | 3e26cf0cb22151eae14975f244c091d32d397cee | |
| parent | eee239dadee4d599c279a7e24972d72c1edcce4d (diff) | |
| download | STC-modified-57b1cc9c1969b1e1b684924b42b0018f567d63d9.tar.gz STC-modified-57b1cc9c1969b1e1b684924b42b0018f567d63d9.zip | |
Removed assumptions about clist iterators.
| -rw-r--r-- | stc/clist.h | 4 |
1 files 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; \
} \
|
