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

Function raxCompressNode

rax.c:514–528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

512}
513
514raxNode *raxCompressNode(raxNode *n, unsigned char *s, size_t len, raxNode **child) {
515 /* Allocate the child to link to this node. */
516 *child = raxNewNode(0,0);
517 if (*child == NULL) return NULL;
518
519 raxNode *newn = raxCompressNodeNoAlloc(n,s,len);
520 if (newn == NULL) {
521 rax_free(*child);
522 return NULL;
523 }
524 n = newn;
525 raxNode **childfield = raxNodeLastChildPtr(n);
526 memcpy(childfield,child,sizeof(*child));
527 return n;
528}
529
530/* Low level function that walks the tree looking for the string
531 * 's' of 'len' bytes. The function returns the number of characters

Callers 1

raxGenericInsertFunction · 0.85

Calls 2

raxNewNodeFunction · 0.85
raxCompressNodeNoAllocFunction · 0.85

Tested by

no test coverage detected