VirtualBox

Ignore:
Timestamp:
Feb 4, 2008 2:08:02 AM (17 years ago)
Author:
bird
Message:

kAVL: Implemented locking, root node and a direct cache.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/k/kAvlTmpl/kAvlGetWithParent.h

    r2 r7  
    3737 * The tree remains unchanged.
    3838 *
    39  * @returns   Pointer to the node holding the given key.
    40  * @param     ppTree    Pointer to the AVL-tree root node pointer.
    41  * @param     ppParent  Pointer to a variable which will hold the pointer to the partent node on
     39 * @returns Pointer to the node holding the given key.
     40 * @param   pRoot       Pointer to the AVL-tree root structure.
     41 * @param   ppParent    Pointer to a variable which will hold the pointer to the partent node on
    4242 *                      return. When no node is found, this will hold the last searched node.
    43  * @param     Key       Key value of the node which is to be found.
     43 * @param   Key         Key value of the node which is to be found.
    4444 */
    45 KAVL_DECL(KAVLNODE *) KAVL_FN(GetWithParent)(KAVLTREEPTR *ppTree, KAVLNODE **ppParent, KAVLKEY Key)
     45KAVL_DECL(KAVLNODE *) KAVL_FN(GetWithParent)(KAVLROOT *pRoot, KAVLNODE **ppParent, KAVLKEY Key)
    4646{
    47     register KAVLNODE *pNode = KAVL_GET_POINTER_NULL(ppTree);
    48     register KAVLNODE *pParent = NULL;
     47    register KAVLNODE *pNode;
     48    register KAVLNODE *pParent;
    4949
     50    KAVL_READ_LOCK(pRoot);
     51
     52    pParent = NULL;
     53    pNode = KAVL_GET_POINTER_NULL(&pRoot->mpRoot);
    5054    while (     pNode != NULL
    5155           &&   KAVL_NE(pNode->mKey, Key))
     
    5862    }
    5963
     64    KAVL_UNLOCK(pRoot);
     65
    6066    *ppParent = pParent;
    6167    return pNode;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette