479 cx_attr_nonnull |
481 cx_attr_nonnull |
480 static inline int cxListInsertSorted( |
482 static inline int cxListInsertSorted( |
481 CxList *list, |
483 CxList *list, |
482 const void *elem |
484 const void *elem |
483 ) { |
485 ) { |
484 list->collection.sorted = true; // guaranteed by definition |
486 assert(list->collection.sorted || list->collection.size == 0); |
|
487 list->collection.sorted = true; |
485 const void *data = list->collection.store_pointer ? &elem : elem; |
488 const void *data = list->collection.store_pointer ? &elem : elem; |
486 return list->cl->insert_sorted(list, data, 1) == 0; |
489 return list->cl->insert_sorted(list, data, 1) == 0; |
487 } |
490 } |
488 |
491 |
489 /** |
492 /** |
539 static inline size_t cxListInsertSortedArray( |
542 static inline size_t cxListInsertSortedArray( |
540 CxList *list, |
543 CxList *list, |
541 const void *array, |
544 const void *array, |
542 size_t n |
545 size_t n |
543 ) { |
546 ) { |
544 list->collection.sorted = true; // guaranteed by definition |
547 assert(list->collection.sorted || list->collection.size == 0); |
|
548 list->collection.sorted = true; |
545 return list->cl->insert_sorted(list, array, n); |
549 return list->cl->insert_sorted(list, array, n); |
546 } |
550 } |
547 |
551 |
548 /** |
552 /** |
549 * Inserts an element after the current location of the specified iterator. |
553 * Inserts an element after the current location of the specified iterator. |
777 * |
781 * |
778 * @param list the list |
782 * @param list the list |
779 */ |
783 */ |
780 cx_attr_nonnull |
784 cx_attr_nonnull |
781 static inline void cxListClear(CxList *list) { |
785 static inline void cxListClear(CxList *list) { |
|
786 list->cl->clear(list); |
782 list->collection.sorted = true; // empty lists are always sorted |
787 list->collection.sorted = true; // empty lists are always sorted |
783 list->cl->clear(list); |
|
784 } |
788 } |
785 |
789 |
786 /** |
790 /** |
787 * Swaps two items in the list. |
791 * Swaps two items in the list. |
788 * |
792 * |