src/cx/linked_list.h

changeset 526
b070ef465313
parent 508
8aea65ae1eaf
child 528
4fbfac557df8
equal deleted inserted replaced
525:536646d1575b 526:b070ef465313
46 #endif 46 #endif
47 47
48 /** 48 /**
49 * Allocates a linked list for storing elements with \p item_size bytes each. 49 * Allocates a linked list for storing elements with \p item_size bytes each.
50 * 50 *
51 * Elements added to the list are copied. 51 * @remark Elements added to the list are copied, therefore a possible cx_list_s.content_destructor
52 * MUST NOT free the memory pointed to by its argument.
52 * 53 *
53 * @param allocator the allocator for allocating the list nodes 54 * @param allocator the allocator for allocating the list nodes
54 * @param comparator the comparator for the elements 55 * @param comparator the comparator for the elements
55 * @param item_size the size of each element in bytes 56 * @param item_size the size of each element in bytes
56 * @return the created list 57 * @return the created list
64 /** 65 /**
65 * Allocates a linked list for storing pointers. 66 * Allocates a linked list for storing pointers.
66 * 67 *
67 * If you want to store the elements directly in this list, use cxLinkedListCreate(). 68 * If you want to store the elements directly in this list, use cxLinkedListCreate().
68 * 69 *
70 * @remark Since only pointers are stored in this list, a possible cx_list_s.content_destructor
71 * MAY free the memory pointed to by its argument in order to prevent memory leaks.
72 *
69 * @param allocator the allocator for allocating the list nodes 73 * @param allocator the allocator for allocating the list nodes
70 * @param comparator the comparator for the elements 74 * @param comparator the comparator for the elements
71 * @return the created list 75 * @return the created list
72 */ 76 */
73 CxList *cxPointerLinkedListCreate( 77 CxList *cxPointerLinkedListCreate(
75 CxListComparator comparator 79 CxListComparator comparator
76 ) __attribute__((__nonnull__)); 80 ) __attribute__((__nonnull__));
77 81
78 /** 82 /**
79 * Creates a linked list using the data from an array. 83 * Creates a linked list using the data from an array.
84 *
85 * @remark Elements added to the list are copied, therefore a possible cx_list_s.content_destructor
86 * MUST NOT free the memory pointed to by its argument.
80 * 87 *
81 * @param allocator the allocator for allocating the list nodes 88 * @param allocator the allocator for allocating the list nodes
82 * @param comparator the comparator for the elements 89 * @param comparator the comparator for the elements
83 * @param item_size the size of one item in the array 90 * @param item_size the size of one item in the array
84 * @param num_items the number of items 91 * @param num_items the number of items

mercurial