MCPcopy Create free account
hub / github.com/F-Stack/f-stack / listCreate

Function listCreate

app/redis-6.2.6/src/adlist.c:42–54  ·  view source on GitHub ↗

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. */

Source from the content-addressed store, hash-verified

40 *
41 * On error, NULL is returned. Otherwise the pointer to the new list. */
42list *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. */
57void listEmpty(list *list)

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected