diff -r 35bcb3216c0d -r 6bbbf219251d src/list.c --- a/src/list.c Thu May 23 20:31:37 2024 +0200 +++ b/src/list.c Thu May 23 20:43:04 2024 +0200 @@ -47,14 +47,14 @@ static void cx_pl_hack_cmpfunc(struct cx_list_s const *list) { // cast away const - this is the hacky thing - struct cx_collection_s *l = (struct cx_collection_s*) &list->base; + struct cx_collection_s *l = (struct cx_collection_s*) &list->collection; cx_pl_cmpfunc_impl = l->cmpfunc; l->cmpfunc = cx_pl_cmpfunc; } static void cx_pl_unhack_cmpfunc(struct cx_list_s const *list) { // cast away const - this is the hacky thing - struct cx_collection_s *l = (struct cx_collection_s*) &list->base; + struct cx_collection_s *l = (struct cx_collection_s*) &list->collection; l->cmpfunc = cx_pl_cmpfunc_impl; } @@ -180,7 +180,7 @@ }; void cxListStoreObjects(CxList *list) { - list->base.store_pointer = false; + list->collection.store_pointer = false; if (list->climpl != NULL) { list->cl = list->climpl; list->climpl = NULL; @@ -188,8 +188,8 @@ } void cxListStorePointers(CxList *list) { - list->base.elem_size = sizeof(void *); - list->base.store_pointer = true; + list->collection.elem_size = sizeof(void *); + list->collection.store_pointer = true; list->climpl = list->cl; list->cl = &cx_pointer_list_class; } @@ -221,7 +221,7 @@ __attribute__((__unused__)) struct cx_list_s const *list, struct cx_list_s const *other ) { - if (other->base.size == 0) return 0; + if (other->collection.size == 0) return 0; return -1; } @@ -286,7 +286,7 @@ ) { if ( // if one is storing pointers but the other is not - (list->base.store_pointer ^ other->base.store_pointer) || + (list->collection.store_pointer ^ other->collection.store_pointer) || // if one class is wrapped but the other is not ((list->climpl == NULL) ^ (other->climpl == NULL)) || @@ -296,13 +296,13 @@ (other->climpl != NULL ? other->climpl->compare : other->cl->compare)) ) { // lists are definitely different - cannot use internal compare function - if (list->base.size == other->base.size) { + if (list->collection.size == other->collection.size) { CxIterator left = list->cl->iterator(list, 0, false); CxIterator right = other->cl->iterator(other, 0, false); - for (size_t i = 0; i < list->base.size; i++) { + for (size_t i = 0; i < list->collection.size; i++) { void *leftValue = cxIteratorCurrent(left); void *rightValue = cxIteratorCurrent(right); - int d = list->base.cmpfunc(leftValue, rightValue); + int d = list->collection.cmpfunc(leftValue, rightValue); if (d != 0) { return d; } @@ -311,7 +311,7 @@ } return 0; } else { - return list->base.size < other->base.size ? -1 : 1; + return list->collection.size < other->collection.size ? -1 : 1; } } else { // lists are compatible