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

Function zslCreate

app/redis-6.2.6/src/t_zset.c:80–95  ·  view source on GitHub ↗

Create a new skiplist. */

Source from the content-addressed store, hash-verified

78
79/* Create a new skiplist. */
80zskiplist *zslCreate(void) {
81 int j;
82 zskiplist *zsl;
83
84 zsl = zmalloc(sizeof(*zsl));
85 zsl->level = 1;
86 zsl->length = 0;
87 zsl->header = zslCreateNode(ZSKIPLIST_MAXLEVEL,0,NULL);
88 for (j = 0; j < ZSKIPLIST_MAXLEVEL; j++) {
89 zsl->header->level[j].forward = NULL;
90 zsl->header->level[j].span = 0;
91 }
92 zsl->header->backward = NULL;
93 zsl->tail = NULL;
94 return zsl;
95}
96
97/* Free the specified skiplist node. The referenced SDS string representation
98 * of the element is freed too, unless node->ele is set to NULL before calling

Callers 2

createZsetObjectFunction · 0.85
zsetConvertFunction · 0.85

Calls 2

zmallocFunction · 0.85
zslCreateNodeFunction · 0.85

Tested by

no test coverage detected