From ce9ef95a3beb195b5f29fde80a3d7b0f57f84c22 Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sat, 2 Oct 2021 12:48:32 +0200 Subject: Moved ref member in clist_X_iter_t to start of struct; --- include/stc/clist.h | 6 +++--- include/stc/forward.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/stc/clist.h b/include/stc/clist.h index 7678b540..071cd8cb 100644 --- a/include/stc/clist.h +++ b/include/stc/clist.h @@ -135,13 +135,13 @@ cx_memb(_copy)(Self *self, Self other) { STC_INLINE cx_iter_t cx_memb(_iter)(const Self* self, cx_node_t* prev) { - return c_make(cx_iter_t){&self->last, prev, &prev->next->value}; + return c_make(cx_iter_t){&prev->next->value, &self->last, prev}; } STC_INLINE cx_iter_t cx_memb(_begin)(const Self* self) { cx_value_t* head = self->last ? &self->last->next->value : NULL; - return c_make(cx_iter_t){&self->last, self->last, head}; + return c_make(cx_iter_t){head, &self->last, self->last}; } STC_INLINE cx_iter_t @@ -290,7 +290,7 @@ cx_memb(_split_off)(Self* self, cx_iter_t it1, cx_iter_t it2) { Self cx = {NULL}; if (it1.ref == it2.ref) return cx; cx_node_t *p1 = it1.prev, - *p2 = it2.ref ? it2.prev : self->last; + *p2 = it2.ref ? it2.prev : self->last; p1->next = p2->next, p2->next = clist_node_(it1.ref); if (self->last == p2) self->last = (p1 == p2) ? NULL : p1; cx.last = p2; diff --git a/include/stc/forward.h b/include/stc/forward.h index 2d22b9ca..ec5f77b9 100644 --- a/include/stc/forward.h +++ b/include/stc/forward.h @@ -65,8 +65,8 @@ typedef struct SELF##_node_t SELF##_node_t; \ \ typedef struct { \ - SELF##_node_t *const *_last, *prev; \ SELF##_value_t *ref; \ + SELF##_node_t *const *_last, *prev; \ } SELF##_iter_t; \ \ typedef struct { \ -- cgit v1.2.3