MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / listCreate

Function listCreate

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), MALLOC_SHARED)) == 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)

Callers 15

scanGenericCommandFunction · 0.85
initializeMethod · 0.85
pubsubSubscribeChannelFunction · 0.85
pubsubSubscribePatternFunction · 0.85
listDupFunction · 0.85
clusterManagerOnErrorFunction · 0.85

Calls 1

zmallocFunction · 0.85

Tested by

no test coverage detected