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

Function raxNew

rax.c:248–260  ·  view source on GitHub ↗

Allocate a new rax and return its pointer. On out of memory the function * returns NULL. */

Source from the content-addressed store, hash-verified

246/* Allocate a new rax and return its pointer. On out of memory the function
247 * returns NULL. */
248rax *raxNew(void) {
249 rax *rax = rax_malloc(sizeof(*rax));
250 if (rax == NULL) return NULL;
251 rax->numele = 0;
252 rax->numnodes = 1;
253 rax->head = raxNewNode(0,0);
254 if (rax->head == NULL) {
255 rax_free(rax);
256 return NULL;
257 } else {
258 return rax;
259 }
260}
261
262/* realloc the node to make room for auxiliary data in order
263 * to store an item in that node. On out of memory NULL is returned. */

Callers 1

tool_memory_init_lockedFunction · 0.85

Calls 1

raxNewNodeFunction · 0.85

Tested by

no test coverage detected