• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/samba-3.0.13/source/lib/

Lines Matching refs:tree

26  Initialize the tree's root.  The cmp_fn is a callback function used
53 Initialize the tree's root. The cmp_fn is a callback function used
61 SORTED_TREE *tree = NULL;
63 if ( !(tree = SMB_MALLOC_P(SORTED_TREE)) )
66 ZERO_STRUCTP( tree );
68 tree->compare = cmp_fn;
69 tree->free_func = free_fn;
71 if ( !(tree->root = SMB_MALLOC_P(TREE_NODE)) ) {
72 SAFE_FREE( tree );
76 ZERO_STRUCTP( tree->root );
77 tree->root->data_p = data_p;
79 return tree;
84 Delete a tree and free all allocated memory
106 Delete a tree and free all allocated memory
109 void pathtree_destroy( SORTED_TREE *tree )
111 if ( tree->root )
112 pathtree_destroy_children( tree->root );
114 if ( tree->free_func )
115 tree->free_func( tree->root );
117 SAFE_FREE( tree );
239 Add a new node into the tree given a key path and a blob of data
242 BOOL pathtree_add( SORTED_TREE *tree, const char *path, void *data_p )
256 if ( !tree ) {
257 DEBUG(0,("pathtree_add: Attempt to add a node to an uninitialized tree!\n"));
279 current = tree->root;
314 DEBUG(10,("pathtree_add: Successfully added node [%s] to tree\n",
357 Dump the kys for a tree to the log file
360 void pathtree_print_keys( SORTED_TREE *tree, int debug )
363 int num_children = tree->root->num_children;
365 if ( tree->root->key )
366 DEBUG(debug,("ROOT/: [%s] (%s)\n", tree->root->key,
367 tree->root->data_p ? "data" : "NULL" ));
370 pathtree_print_children( tree->root->children[i], debug,
371 tree->root->key ? tree->root->key : "ROOT/" );
377 return the data_p for for the node in tree matching the key string
379 the tree
382 void* pathtree_find( SORTED_TREE *tree, char *key )
393 DEBUG(0,("pathtree_find: Attempt to search tree using NULL search string!\n"));
397 if ( !tree ) {
398 DEBUG(0,("pathtree_find: Attempt to search an uninitialized tree using string [%s]!\n",
403 if ( !tree->root )
421 current = tree->root;
423 if ( tree->root->data_p )
424 result = tree->root->data_p;
454 /* result should be the data_p from the lowest match node in the tree */