1.1 --- a/src/list.c Thu May 23 20:31:37 2024 +0200 1.2 +++ b/src/list.c Thu May 23 20:43:04 2024 +0200 1.3 @@ -47,14 +47,14 @@ 1.4 1.5 static void cx_pl_hack_cmpfunc(struct cx_list_s const *list) { 1.6 // cast away const - this is the hacky thing 1.7 - struct cx_collection_s *l = (struct cx_collection_s*) &list->base; 1.8 + struct cx_collection_s *l = (struct cx_collection_s*) &list->collection; 1.9 cx_pl_cmpfunc_impl = l->cmpfunc; 1.10 l->cmpfunc = cx_pl_cmpfunc; 1.11 } 1.12 1.13 static void cx_pl_unhack_cmpfunc(struct cx_list_s const *list) { 1.14 // cast away const - this is the hacky thing 1.15 - struct cx_collection_s *l = (struct cx_collection_s*) &list->base; 1.16 + struct cx_collection_s *l = (struct cx_collection_s*) &list->collection; 1.17 l->cmpfunc = cx_pl_cmpfunc_impl; 1.18 } 1.19 1.20 @@ -180,7 +180,7 @@ 1.21 }; 1.22 1.23 void cxListStoreObjects(CxList *list) { 1.24 - list->base.store_pointer = false; 1.25 + list->collection.store_pointer = false; 1.26 if (list->climpl != NULL) { 1.27 list->cl = list->climpl; 1.28 list->climpl = NULL; 1.29 @@ -188,8 +188,8 @@ 1.30 } 1.31 1.32 void cxListStorePointers(CxList *list) { 1.33 - list->base.elem_size = sizeof(void *); 1.34 - list->base.store_pointer = true; 1.35 + list->collection.elem_size = sizeof(void *); 1.36 + list->collection.store_pointer = true; 1.37 list->climpl = list->cl; 1.38 list->cl = &cx_pointer_list_class; 1.39 } 1.40 @@ -221,7 +221,7 @@ 1.41 __attribute__((__unused__)) struct cx_list_s const *list, 1.42 struct cx_list_s const *other 1.43 ) { 1.44 - if (other->base.size == 0) return 0; 1.45 + if (other->collection.size == 0) return 0; 1.46 return -1; 1.47 } 1.48 1.49 @@ -286,7 +286,7 @@ 1.50 ) { 1.51 if ( 1.52 // if one is storing pointers but the other is not 1.53 - (list->base.store_pointer ^ other->base.store_pointer) || 1.54 + (list->collection.store_pointer ^ other->collection.store_pointer) || 1.55 1.56 // if one class is wrapped but the other is not 1.57 ((list->climpl == NULL) ^ (other->climpl == NULL)) || 1.58 @@ -296,13 +296,13 @@ 1.59 (other->climpl != NULL ? other->climpl->compare : other->cl->compare)) 1.60 ) { 1.61 // lists are definitely different - cannot use internal compare function 1.62 - if (list->base.size == other->base.size) { 1.63 + if (list->collection.size == other->collection.size) { 1.64 CxIterator left = list->cl->iterator(list, 0, false); 1.65 CxIterator right = other->cl->iterator(other, 0, false); 1.66 - for (size_t i = 0; i < list->base.size; i++) { 1.67 + for (size_t i = 0; i < list->collection.size; i++) { 1.68 void *leftValue = cxIteratorCurrent(left); 1.69 void *rightValue = cxIteratorCurrent(right); 1.70 - int d = list->base.cmpfunc(leftValue, rightValue); 1.71 + int d = list->collection.cmpfunc(leftValue, rightValue); 1.72 if (d != 0) { 1.73 return d; 1.74 } 1.75 @@ -311,7 +311,7 @@ 1.76 } 1.77 return 0; 1.78 } else { 1.79 - return list->base.size < other->base.size ? -1 : 1; 1.80 + return list->collection.size < other->collection.size ? -1 : 1; 1.81 } 1.82 } else { 1.83 // lists are compatible