src/cx/linked_list.h

changeset 488
9138acaa494b
parent 487
4bd19279778c
child 489
af6be1e123aa
     1.1 --- a/src/cx/linked_list.h	Tue Dec 28 14:25:05 2021 +0100
     1.2 +++ b/src/cx/linked_list.h	Tue Dec 28 17:24:18 2021 +0100
     1.3 @@ -59,7 +59,7 @@
     1.4          CxAllocator allocator,
     1.5          CxListComparator comparator,
     1.6          size_t item_size
     1.7 -);
     1.8 +) __attribute__((__nonnull__));
     1.9  
    1.10  /**
    1.11   * Allocates a linked list for storing pointers.
    1.12 @@ -73,7 +73,25 @@
    1.13  CxList cxPointerLinkedListCreate(
    1.14          CxAllocator allocator,
    1.15          CxListComparator comparator
    1.16 -);
    1.17 +) __attribute__((__nonnull__));
    1.18 +
    1.19 +/**
    1.20 + * Creates a linked list using the data from an array.
    1.21 + *
    1.22 + * @param allocator the allocator for allocating the list nodes
    1.23 + * @param comparator the comparator for the elements
    1.24 + * @param item_size the size of one item in the array
    1.25 + * @param num_items the number of items
    1.26 + * @param array the array data
    1.27 + * @return the created list
    1.28 + */
    1.29 +CxList cxLinkedListFromArray(
    1.30 +        CxAllocator allocator,
    1.31 +        CxListComparator comparator,
    1.32 +        size_t item_size,
    1.33 +        size_t num_items,
    1.34 +        const void *array
    1.35 +) __attribute__((__nonnull__));
    1.36  
    1.37  /**
    1.38   * Deallocates the memory of the entire list.
    1.39 @@ -82,7 +100,7 @@
    1.40   *
    1.41   * @param list the list
    1.42   */
    1.43 -void cxLinkedListDestroy(CxList list);
    1.44 +void cxLinkedListDestroy(CxList list) __attribute__((__nonnull__));
    1.45  
    1.46  /**
    1.47   * Finds the node at a certain index.
    1.48 @@ -386,6 +404,8 @@
    1.49  /**
    1.50   * Compares two lists element wise.
    1.51   *
    1.52 + * \note Both list must have the same structure.
    1.53 + *
    1.54   * @param begin_left the begin of the left list (\c NULL denotes an empty list)
    1.55   * @param begin_right the begin of the right list  (\c NULL denotes an empty list)
    1.56   * @param loc_advance the location of the pointer to advance

mercurial