home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / OBJASM.ZIP / OUNEWTRE.C < prev    next >
C/C++ Source or Header  |  1989-05-24  |  670b  |  24 lines

  1. #include <stdio.h>
  2. #include "o.h"
  3.  
  4. NODE_T *new_tree( data_ptr, dup_allowed )
  5.     char    *data_ptr;
  6.     int     dup_allowed;
  7. {
  8.     NODE_T  *tree;
  9.  
  10.     tree = (NODE_T *)o_malloc(sizeof(NODE_T));
  11.     tree->data          = data_ptr;
  12.     if ( dup_allowed ) {            /* Hide the duplicates allowed indicator */
  13.         tree->balance = LEFT;       /* in the tree root's balance!           */
  14.     } else {
  15.         tree->balance = RIGHT;
  16.     }
  17.     tree->ptr   [LEFT ] = 0;        /* Hide the tree depth in left pointer */
  18.     tree->ptr   [RIGHT] = (NODE_T *)tree;
  19.     tree->thread[LEFT ] = TRUE;
  20.     tree->thread[RIGHT] = TRUE;
  21.     return( tree );
  22. }
  23.  
  24.