VirtualBox

Changeset 93690 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Feb 11, 2022 10:10:11 AM (3 years ago)
Author:
vboxsync
Message:

IPRT/avl: Added some height assertions.

Location:
trunk/src/VBox/Runtime/common/table
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/table/avl_Base.cpp.h

    r93115 r93690  
    320320        else
    321321            break;
     322        Assert(pCurNode->uchHeight == RT_MAX(AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pCurNode->pLeft)),
     323                                             AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pCurNode->pRight))) + 1);
    322324
    323325        kASSERT(AVLStack.cEntries < KAVL_MAX_STACK);
     
    411413        else
    412414            return NULL;
     415        Assert(pDeleteNode->uchHeight == RT_MAX(AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pDeleteNode->pLeft)),
     416                                                AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pDeleteNode->pRight))) + 1);
    413417
    414418        kASSERT(AVLStack.cEntries < KAVL_MAX_STACK);
  • trunk/src/VBox/Runtime/common/table/avl_DoWithAll.cpp.h

    r93115 r93690  
    7272
    7373            /* center */
     74            Assert(pNode->uchHeight == RT_MAX(AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pNode->pLeft)),
     75                                              AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pNode->pRight))) + 1);
    7476            rc = pfnCallBack(pNode, pvParam);
    7577            if (rc != VINF_SUCCESS)
     
    112114
    113115            /* center */
     116            Assert(pNode->uchHeight == RT_MAX(AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pNode->pLeft)),
     117                                              AVL_HEIGHTOF(KAVL_GET_POINTER_NULL(&pNode->pRight))) + 1);
    114118            rc = pfnCallBack(pNode, pvParam);
    115119            if (rc != VINF_SUCCESS)
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