VirtualBox

Changeset 93689 in vbox for trunk/include/iprt/cpp


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

IPRT/hardavl: Fixed the removal bug. Extended testcase and sanity checks. [doxygen fix] bugref:10093

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/hardavlrange.h

    r93685 r93689  
    731731     * @param     a_pAllocator  Pointer to the allocator.
    732732     * @param     a_pStack      Pointer to stack to rewind.
     733     * @param     a_fLog        Log is done (DEBUG builds only).
    733734     *
    734735     * @code
     
    781782     * @internal
    782783     */
    783     int i_rebalance(RTCHardAvlTreeSlabAllocator<NodeType> *a_pAllocator, HardAvlStack *a_pStack, bool fLog = false)
    784     {
    785         RT_NOREF(fLog);
     784    int i_rebalance(RTCHardAvlTreeSlabAllocator<NodeType> *a_pAllocator, HardAvlStack *a_pStack, bool a_fLog = false)
     785    {
     786        RT_NOREF(a_fLog);
    786787
    787788        while (a_pStack->cEntries > 0)
     
    842843                    *pidxNode = idxLeftNode;
    843844#ifdef DEBUG
    844                     if (fLog) RTAssertMsg2("rebalance: %#2u: op #1\n", a_pStack->cEntries);
     845                    if (a_fLog) RTAssertMsg2("rebalance: %#2u: op #1\n", a_pStack->cEntries);
    845846#endif
    846847                }
     
    864865                    *pidxNode = idxLeftRightNode;
    865866#ifdef DEBUG
    866                     if (fLog) RTAssertMsg2("rebalance: %#2u: op #2\n", a_pStack->cEntries);
     867                    if (a_fLog) RTAssertMsg2("rebalance: %#2u: op #2\n", a_pStack->cEntries);
    867868#endif
    868869                }
     
    896897                    *pidxNode = idxRightNode;
    897898#ifdef DEBUG
    898                     if (fLog) RTAssertMsg2("rebalance: %#2u: op #3 h=%d, *pidxNode=%#x\n", a_pStack->cEntries, pRightNode->cHeight, *pidxNode);
     899                    if (a_fLog) RTAssertMsg2("rebalance: %#2u: op #3 h=%d, *pidxNode=%#x\n", a_pStack->cEntries, pRightNode->cHeight, *pidxNode);
    899900#endif
    900901                    RTHARDAVL_STRICT_CHECK_HEIGHTS(pRightNode, NULL, 0);
     
    920921                    *pidxNode = idxRightLeftNode;
    921922#ifdef DEBUG
    922                     if (fLog) RTAssertMsg2("rebalance: %#2u: op #4 h=%d, *pidxNode=%#x\n", a_pStack->cEntries, pRightLeftNode->cHeight, *pidxNode);
     923                    if (a_fLog) RTAssertMsg2("rebalance: %#2u: op #4 h=%d, *pidxNode=%#x\n", a_pStack->cEntries, pRightLeftNode->cHeight, *pidxNode);
    923924#endif
    924925                }
     
    931932                {
    932933#ifdef DEBUG
    933                     if (fLog) RTAssertMsg2("rebalance: %#2u: op #5, h=%d - done\n", a_pStack->cEntries, cHeight);
     934                    if (a_fLog) RTAssertMsg2("rebalance: %#2u: op #5, h=%d - done\n", a_pStack->cEntries, cHeight);
    934935#endif
    935936                    RTHARDAVL_STRICT_CHECK_HEIGHTS(pNode, NULL, 0);
     
    941942                }
    942943#ifdef DEBUG
    943                 if (fLog) RTAssertMsg2("rebalance: %#2u: op #5, h=%d - \n", a_pStack->cEntries, cHeight);
     944                if (a_fLog) RTAssertMsg2("rebalance: %#2u: op #5, h=%d - \n", a_pStack->cEntries, cHeight);
    944945#endif
    945946                pNode->cHeight = cHeight;
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