src/linked_list.c

changeset 670
4ad8ea3aee49
parent 667
2f88a7c13a28
child 677
b09aae58bba4
     1.1 --- a/src/linked_list.c	Tue Mar 28 19:13:33 2023 +0200
     1.2 +++ b/src/linked_list.c	Tue Mar 28 21:00:33 2023 +0200
     1.3 @@ -925,11 +925,15 @@
     1.4          cx_ll_iterator,
     1.5  };
     1.6  
     1.7 -static CxList *cx_linked_list_create(
     1.8 +CxList *cxLinkedListCreate(
     1.9          CxAllocator const *allocator,
    1.10          CxListComparator comparator,
    1.11          size_t item_size
    1.12  ) {
    1.13 +    if (allocator == NULL) {
    1.14 +        allocator = cxDefaultAllocator;
    1.15 +    }
    1.16 +
    1.17      cx_linked_list *list = cxCalloc(allocator, 1, sizeof(cx_linked_list));
    1.18      if (list == NULL) return NULL;
    1.19  
    1.20 @@ -946,15 +950,3 @@
    1.21  
    1.22      return (CxList *) list;
    1.23  }
    1.24 -
    1.25 -CxList *cxLinkedListCreate(
    1.26 -        CxAllocator const *allocator,
    1.27 -        CxListComparator comparator,
    1.28 -        size_t item_size
    1.29 -) {
    1.30 -    return cx_linked_list_create(allocator, comparator, item_size);
    1.31 -}
    1.32 -
    1.33 -CxList *cxLinkedListCreateSimple(size_t item_size) {
    1.34 -    return cx_linked_list_create(cxDefaultAllocator, NULL, item_size);
    1.35 -}

mercurial