src/linked_list.c

changeset 404
86ebc3745e62
parent 403
8fa43b732980
child 406
9cbea761fbf7
     1.1 --- a/src/linked_list.c	Sun Feb 07 21:14:39 2021 +0100
     1.2 +++ b/src/linked_list.c	Sun Feb 07 21:26:48 2021 +0100
     1.3 @@ -135,12 +135,19 @@
     1.4      return 0;
     1.5  }
     1.6  
     1.7 +void *cx_ll_last(cx_list *list) {
     1.8 +    cx_linked_list *ll = list->listdata;
     1.9 +    struct cx_linked_list_node *last = cx_linked_list_last(
    1.10 +            NULL, &ll->end, offsetof(struct cx_linked_list_node, next));
    1.11 +    return &last->payload;
    1.12 +}
    1.13  
    1.14  cx_list_class cx_linked_list_class = {
    1.15          cx_ll_add,
    1.16          cx_ll_insert,
    1.17          cx_ll_remove,
    1.18 -        cx_ll_find
    1.19 +        cx_ll_find,
    1.20 +        cx_ll_last
    1.21  };
    1.22  
    1.23  CxList cxLinkedListCreate(CxAllocator allocator, CxListComparator comparator, size_t itemsize) {

mercurial