Ignore:
Timestamp:
Mar 24, 2000, 2:40:52 AM (25 years ago)
Author:
bird
Message:

Corrected test for equal key in AVLInsert.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/fastdep/avl.c

    r3129 r3212  
    1 /* $Id: avl.c,v 1.1 2000-03-16 21:10:10 bird Exp $
     1/* $Id: avl.c,v 1.2 2000-03-24 01:40:52 bird Exp $
    22 *
    33 * AVL-Tree (lookalike) implementation.
     
    9393    {
    9494        assert(AVLStack.cEntries < AVL_MAX_HEIGHT);
     95        assert(pNode != pCurNode);
    9596        AVLStack.aEntries[AVLStack.cEntries++] = ppCurNode;
     97        #ifdef AVL_MAY_TRY_INSERT_EQUAL
     98        /* check if equal */
     99        if (AVL_E(pCurNode->Key, Key))
     100            return FALSE;
     101        #endif
    96102        if (AVL_G(pCurNode->Key, Key))
    97103            ppCurNode = &pCurNode->pLeft;
     
    99105            ppCurNode = &pCurNode->pRight;
    100106    }
    101 
    102 #ifdef AVL_MAY_TRY_INSERT_EQUAL
    103     /* check if equal */
    104     if (AVLStack.cEntries > 0 && AVL_E((*AVLStack.aEntries[AVLStack.cEntries-1])->Key, pNode->Key))
    105         return FALSE;
    106 #endif
    107107
    108108    pNode->pLeft = pNode->pRight = NULL;
Note: See TracChangeset for help on using the changeset viewer.