Ignore:
Timestamp:
Feb 23, 2001, 7:50:07 AM (24 years ago)
Author:
umoeller
Message:

Misc. fixes.

File:
1 edited

Legend:

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

    r38 r39  
    922922 *      as a data pointer to some structure for whatever you like.
    923923 *
     924 *      WARNING: This function recurses and can use up a lot of
     925 *      stack. For very deep trees, traverse the tree using
     926 *      treeFirst and treeNext instead. See treeNext for a sample.
     927 *
    924928 *      "method" specifies in which order the nodes are traversed.
    925929 *      This can be:
     
    936940                  int method)               // in: traversal mode
    937941{
    938     if ((!tree)
    939     || (tree == TREE_NULL))
     942    if (    (!tree)
     943         || (tree == TREE_NULL))
    940944        return;
    941945
     
    963967 *@@ treeFirst:
    964968 *      finds and returns the first node in a (sub-)tree.
     969 *
     970 *      See treeNext for a sample usage for traversing a tree.
    965971 */
    966972
     
    970976       *current;
    971977
    972     if ((!tree)
    973     ||  (tree == TREE_NULL))
     978    if (    (!tree)
     979         || (tree == TREE_NULL)
     980       )
    974981        return NULL;
    975982
     
    991998       *current;
    992999
    993     if ((!tree)
    994     || (tree == TREE_NULL))
     1000    if (    (!tree)
     1001         || (tree == TREE_NULL))
    9951002        return NULL;
    9961003
     
    10051012 *@@ treeNext:
    10061013 *      finds and returns the next node in a tree.
     1014 *
     1015 *      Example for traversing a whole tree if you don't
     1016 *      want to use treeTraverse:
     1017 *
     1018 +          TREE    *TreeRoot;
     1019 +          ...
     1020 +          TREE* pNode = treeFirst(TreeRoot);
     1021 +          while (pNode)
     1022 +          {
     1023 +              ...
     1024 +              pNode = treeNext(pNode);
     1025 +          }
     1026 *
     1027 *      This runs through the tree items in sorted order.
    10071028 */
    10081029
     
    10131034       *child;
    10141035
    1015     if ((!tree)
    1016     ||  (tree == TREE_NULL))
     1036    if (    (!tree)
     1037         || (tree == TREE_NULL)
     1038       )
    10171039        return NULL;
    10181040
     
    10241046        current = tree;
    10251047        child   = TREE_NULL;
    1026         while ((current->parent)
    1027            &&  (current->right == child))
     1048        while (    (current->parent)
     1049                && (current->right == child)
     1050              )
    10281051        {
    10291052            child = current;
     
    10481071       *child;
    10491072
    1050     if ((!tree)
    1051     || (tree == TREE_NULL))
     1073    if (    (!tree)
     1074         || (tree == TREE_NULL))
    10521075        return NULL;
    10531076
Note: See TracChangeset for help on using the changeset viewer.