Ignore:
Timestamp:
Apr 4, 2001, 4:39:06 PM (24 years ago)
Author:
umoeller
Message:

Misc changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/helpers/tree.c

    r39 r54  
    9191 *         The order of nodes in the tree is determined by calling a
    9292 *         node comparison function provided by the caller
    93  *         (which you must write). This takes two TREE pointers and
    94  *         must return:
    95  *
    96  +           0: tree1 == tree2
    97  +          -1: tree1 < tree2
    98  +          +1: tree1 > tree2
     93 *         (which you must write). This must be declared as:
     94 *
     95 +              int TREEENTRY fnMyCompareNodes(TREE *t1, TREE *t2);
     96 *
     97 *         It obviously receives two TREE pointers, which it must
     98 *         compare and return:
     99 *
     100 +               0: tree1 == tree2
     101 +              -1: tree1 < tree2
     102 +              +1: tree1 > tree2
    99103 *
    100104 *      -- The "ID" functions (e.g. treeInsertID) do not require
     
    197201 */
    198202
    199 int fnCompareIDs(unsigned long id1, unsigned long id2)
     203int TREEENTRY fnCompareIDs(unsigned long id1, unsigned long id2)
    200204{
    201205    if (id1 < id2)
     
    259263                 BOOL fAllowDuplicates)   // in: whether duplicates with the same ID are allowed
    260264{
    261     TREE
    262        *current,
    263        *parent;
    264     int
    265         last_comp = 0;
     265    TREE    *current,
     266            *parent;
     267    int     last_comp = 0;
    266268
    267269    // find where node belongs
     
    276278            case -1: current = current->left;  break;
    277279            case  1: current = current->right; break;
    278             default: if (fAllowDuplicates)
    279                          current = current->left;
    280                      else
    281                          return TREE_DUPLICATE;
    282 
     280            default:
     281                if (fAllowDuplicates)
     282                    current = current->left;
     283                else
     284                    return TREE_DUPLICATE;
    283285        }
    284286    }
     
    691693 *@@ treeFindEQID:
    692694 *      finds a node with ID exactly matching that provided.
     695 *      Returns NULL if not found.
    693696 */
    694697
     
    698701    TREE
    699702       *current = *root,
    700        *found;
    701 
    702     found = NULL;
     703       *found = NULL;
     704
    703705    while (current != TREE_NULL)
    704706        switch (fnCompareIDs(current->id, id))
Note: See TracChangeset for help on using the changeset viewer.