src/linked_list.c

changeset 528
4fbfac557df8
parent 524
e98b09018d32
child 552
4373c2a90066
equal deleted inserted replaced
527:08539b8273fa 528:4fbfac557df8
777 CxAllocator const *allocator, 777 CxAllocator const *allocator,
778 CxListComparator comparator, 778 CxListComparator comparator,
779 size_t item_size 779 size_t item_size
780 ) { 780 ) {
781 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list)); 781 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list));
782 if (list == NULL) 782 if (list == NULL) return NULL;
783 return NULL;
784 783
785 list->base.cl = &cx_linked_list_class; 784 list->base.cl = &cx_linked_list_class;
786 list->base.allocator = allocator; 785 list->base.allocator = allocator;
787 list->base.cmpfunc = comparator; 786 list->base.cmpfunc = comparator;
788 list->base.itemsize = item_size; 787 list->base.itemsize = item_size;
794 CxList *cxPointerLinkedListCreate( 793 CxList *cxPointerLinkedListCreate(
795 CxAllocator const *allocator, 794 CxAllocator const *allocator,
796 CxListComparator comparator 795 CxListComparator comparator
797 ) { 796 ) {
798 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list)); 797 cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list));
799 if (list == NULL) 798 if (list == NULL) return NULL;
800 return NULL;
801 799
802 list->base.cl = &cx_pointer_linked_list_class; 800 list->base.cl = &cx_pointer_linked_list_class;
803 list->base.allocator = allocator; 801 list->base.allocator = allocator;
804 list->base.cmpfunc = comparator; 802 list->base.cmpfunc = comparator;
805 list->base.itemsize = sizeof(void *); 803 list->base.itemsize = sizeof(void *);

mercurial