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

Function raxRemoveChild

rax.c:1211–1220  ·  view source on GitHub ↗

Low level child removal from node. The new node pointer (after the child * removal) is returned. Note that this function does not fix the pointer * of the parent node in its parent, so this task is up to the caller. * The function never fails for out of memory. */

Source from the content-addressed store, hash-verified

1209 * of the parent node in its parent, so this task is up to the caller.
1210 * The function never fails for out of memory. */
1211raxNode *raxRemoveChild(raxNode *parent, raxNode *child) {
1212 raxNode **cp = raxNodeFirstChildPtr(parent);
1213 while(1) {
1214 raxNode *aux;
1215 memcpy(&aux,cp,sizeof(aux));
1216 if (aux == child) break;
1217 cp++;
1218 }
1219 return raxRemoveChildAtPtr(parent,cp);
1220}
1221
1222/* Free the useless node 'h' that was left after a deletion, and keep moving
1223 * upward while the parent would also become a non-key single-child node.

Callers 1

raxRemoveCleanupFunction · 0.85

Calls 1

raxRemoveChildAtPtrFunction · 0.85

Tested by

no test coverage detected