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

Function raxFindParentLink

rax.c:1124–1133  ·  view source on GitHub ↗

Return the memory address where the 'parent' node stores the specified * 'child' pointer, so that the caller can update the pointer with another * one if needed. The function assumes it will find a match, otherwise the * operation is an undefined behavior (it will continue scanning the * memory without any bound checking). */

Source from the content-addressed store, hash-verified

1122 * operation is an undefined behavior (it will continue scanning the
1123 * memory without any bound checking). */
1124raxNode **raxFindParentLink(raxNode *parent, raxNode *child) {
1125 raxNode **cp = raxNodeFirstChildPtr(parent);
1126 raxNode *c;
1127 while(1) {
1128 memcpy(&c,cp,sizeof(c));
1129 if (c == child) break;
1130 cp++;
1131 }
1132 return cp;
1133}
1134
1135/* Low level child removal from node. 'childptr' must point to the child
1136 * pointer stored inside the parent node, and is used directly instead of

Callers 2

raxRemoveCleanupFunction · 0.85
raxRemoveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected