Changeset 7 in kStuff for trunk/include/k/kAvlTmpl/kAvlRemoveBestFit.h
- Timestamp:
- Feb 4, 2008 2:08:02 AM (17 years ago)
- File:
-
- 1 edited
-
trunk/include/k/kAvlTmpl/kAvlRemoveBestFit.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/k/kAvlTmpl/kAvlRemoveBestFit.h
r2 r7 37 37 * 38 38 * @returns Pointer to the removed node. 39 * @param p pTree Pointer to Pointer to the tree root node.39 * @param pRoot Pointer to the AVL-tree root structure. 40 40 * @param Key The Key of which is to be found a best fitting match for.. 41 41 * @param fAbove K_TRUE: Returned node is have the closest key to Key from above. … … 46 46 * code size, and the likelyhood for bugs. 47 47 */ 48 KAVL_DECL(KAVLNODE *) KAVL_FN(RemoveBestFit)(KAVL TREEPTR *ppTree, KAVLKEY Key, KBOOL fAbove)48 KAVL_DECL(KAVLNODE *) KAVL_FN(RemoveBestFit)(KAVLROOT *pRoot, KAVLKEY Key, KBOOL fAbove) 49 49 { 50 50 /* … … 53 53 * removing the in-tree node as this is way cheaper. 54 54 */ 55 KAVLNODE *pNode = KAVL_FN(GetBestFit)(p pTree, Key, fAbove);55 KAVLNODE *pNode = KAVL_FN(GetBestFit)(pRoot, Key, fAbove); 56 56 if (pNode != NULL) 57 57 { 58 58 #ifdef KAVL_EQUAL_ALLOWED 59 KAVL_WRITE_LOCK(pRoot); /** @todo the locking isn't quite sane here. :-/ */ 59 60 if (pNode->mpList != KAVL_NULL) 60 61 { 61 62 KAVLNODE *pRet = KAVL_GET_POINTER(&pNode->mpList); 62 63 KAVL_SET_POINTER_NULL(&pNode->mpList, &pRet->mpList); 64 KAVL_LOOKTHRU_INVALIDATE_NODE(pRoot, pNode, pNode->mKey); 65 KAVL_WRITE_UNLOCK(pRoot); 63 66 return pRet; 64 67 } 68 KAVL_WRITE_UNLOCK(pRoot); 65 69 #endif 66 pNode = KAVL_FN(Remove)(p pTree, pNode->mKey);70 pNode = KAVL_FN(Remove)(pRoot, pNode->mKey); 67 71 } 68 72 return pNode;
Note:
See TracChangeset
for help on using the changeset viewer.

