MCPcopy Create free account
hub / github.com/antirez/ds4 / raxNewNode

Function raxNewNode

rax.c:232–244  ·  view source on GitHub ↗

Allocate a new non compressed node with the specified number of children. * If datafield is true, the allocation is made large enough to hold the * associated data pointer. * Returns the new node pointer. On out of memory NULL is returned. */

Source from the content-addressed store, hash-verified

230 * associated data pointer.
231 * Returns the new node pointer. On out of memory NULL is returned. */
232raxNode *raxNewNode(size_t children, int datafield) {
233 size_t nodesize = sizeof(raxNode)+children+raxPadding(children)+
234 sizeof(raxNode*)*children;
235 if (datafield) nodesize += sizeof(void*);
236 raxNode *node = rax_malloc(nodesize);
237 if (node == NULL) return NULL;
238 node->iskey = 0;
239 node->isnull = 0;
240 node->iscompr = 0;
241 node->leafbitmap = 0;
242 node->size = children;
243 return node;
244}
245
246/* Allocate a new rax and return its pointer. On out of memory the function
247 * returns NULL. */

Callers 5

raxNewValueNodeFunction · 0.85
raxNewFunction · 0.85
raxAddChildFunction · 0.85
raxCompressNodeFunction · 0.85
raxGenericInsertFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected