93 int cx_ll_add(cx_list *list, void *elem) { |
93 int cx_ll_add(cx_list *list, void *elem) { |
94 cx_linked_list *listdata = list->listdata; |
94 cx_linked_list *listdata = list->listdata; |
95 CxAllocator allocator = list->allocator; |
95 CxAllocator allocator = list->allocator; |
96 |
96 |
97 struct cx_linked_list_node *node = cxMalloc(allocator, |
97 struct cx_linked_list_node *node = cxMalloc(allocator, |
98 sizeof(struct cx_linked_list_node) - sizeof(int) + list->itemsize); |
98 sizeof(struct cx_linked_list_node) + list->itemsize); |
99 if (node == NULL) |
99 if (node == NULL) |
100 return 1; |
100 return 1; |
101 |
101 |
102 node->next = NULL; |
102 node->next = NULL; |
103 memcpy(&node->payload, elem, list->itemsize); |
103 memcpy(&node->payload, elem, list->itemsize); |