Create a new list. The created list can be freed with * listRelease(), but private value of every node need to be freed * by the user before to call listRelease(), or by setting a free method using * listSetFreeMethod. * * On error, NULL is returned. Otherwise the pointer to the new list. */
| 40 | * |
| 41 | * On error, NULL is returned. Otherwise the pointer to the new list. */ |
| 42 | list *listCreate(void) |
| 43 | { |
| 44 | struct list *list; |
| 45 | |
| 46 | if ((list = zmalloc(sizeof(*list))) == NULL) |
| 47 | return NULL; |
| 48 | list->head = list->tail = NULL; |
| 49 | list->len = 0; |
| 50 | list->dup = NULL; |
| 51 | list->free = NULL; |
| 52 | list->match = NULL; |
| 53 | return list; |
| 54 | } |
| 55 | |
| 56 | /* Remove all the elements from the list without destroying the list itself. */ |
| 57 | void listEmpty(list *list) |
no test coverage detected