s3: SORTED_TREE -> struct sorted_tree
authorVolker Lendecke <vl@samba.org>
Sun, 7 Feb 2010 14:45:42 +0000 (15:45 +0100)
committerVolker Lendecke <vl@samba.org>
Sat, 13 Feb 2010 12:26:11 +0000 (13:26 +0100)
source3/include/adt_tree.h
source3/lib/adt_tree.c
source3/registry/reg_cachehook.c

index 08c779180225271ef4e61d041fe3a3d26c8562ec..b9f935ebdc0fbeeb267a4f49677192bf7817874c 100644 (file)
@@ -30,12 +30,12 @@ struct tree_node {
        void                    *data_p;
 };
 
-typedef struct _tree_root {
+struct sorted_tree {
        struct tree_node *root;
 
        /* not used currently (is it needed?) */
        int             (*compare)(void* x, void *y);
-} SORTED_TREE;
+};
 
 /* 
  * API
@@ -43,19 +43,19 @@ typedef struct _tree_root {
 
 /* create a new tree, talloc_free() to throw it away */
 
-SORTED_TREE*  pathtree_init( void *data_p, int (cmp_fn)(void*, void*) );
+struct sorted_tree *pathtree_init( void *data_p, int (cmp_fn)(void*, void*) );
 
 /* add a new path component */
 
-WERROR        pathtree_add( SORTED_TREE *tree, const char *path, void *data_p );
+WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p );
 
 /* search path */
 
-void*         pathtree_find( SORTED_TREE *tree, char *key );
+void *pathtree_find(struct sorted_tree *tree, char *key );
 
 /* debug (print) functions */
 
-void          pathtree_print_keys( SORTED_TREE *tree, int debug );
+void pathtree_print_keys(struct sorted_tree *tree, int debug );
 
 
 #endif
index bb918a81626e8d44f9627026807cc6ba6cc426b5..b184394614468e92b3b4b5645e79e984d0bfebd4 100644 (file)
@@ -50,12 +50,14 @@ static bool trim_tree_keypath( char *path, char **base, char **new_path )
  for comparision of two children
  *************************************************************************/
 
- SORTED_TREE* pathtree_init( void *data_p, int (cmp_fn)(void*, void*) )
+struct sorted_tree *pathtree_init( void *data_p, int (cmp_fn)(void*, void*) )
 {
-       SORTED_TREE *tree = NULL;
+       struct sorted_tree *tree = NULL;
 
-       if ( !(tree = TALLOC_ZERO_P(NULL, SORTED_TREE)) )
+       tree = talloc_zero(NULL, struct sorted_tree);
+       if (tree == NULL) {
                return NULL;
+       }
 
        tree->compare = cmp_fn;
 
@@ -196,7 +198,7 @@ static struct tree_node *pathtree_find_child(struct tree_node *node,
  Add a new node into the tree given a key path and a blob of data
  *************************************************************************/
 
- WERROR pathtree_add( SORTED_TREE *tree, const char *path, void *data_p )
+WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p)
 {
        char *str, *base, *path2;
        struct tree_node *current, *next;
@@ -324,7 +326,7 @@ static void pathtree_print_children(TALLOC_CTX *ctx,
  Dump the kys for a tree to the log file
  *************************************************************************/
 
- void pathtree_print_keys( SORTED_TREE *tree, int debug )
+void pathtree_print_keys(struct sorted_tree *tree, int debug )
 {
        int i;
        int num_children = tree->root->num_children;
@@ -348,7 +350,7 @@ static void pathtree_print_children(TALLOC_CTX *ctx,
  the tree
  *************************************************************************/
 
- void* pathtree_find( SORTED_TREE *tree, char *key )
+void* pathtree_find(struct sorted_tree *tree, char *key )
 {
        char *keystr, *base = NULL, *str = NULL, *p;
        struct tree_node *current;
index 4f84de52860370b70530a31bb3a824b0389cab7e..57097c1ddd2b1c336b365630a1f64647b0fb9545 100644 (file)
@@ -25,7 +25,7 @@
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_REGISTRY
 
-static SORTED_TREE *cache_tree = NULL;
+static struct sorted_tree *cache_tree = NULL;
 extern struct registry_ops regdb_ops;          /* these are the default */
 
 static WERROR keyname_to_path(TALLOC_CTX *mem_ctx, const char *keyname,
@@ -76,7 +76,7 @@ WERROR reghook_cache_init(void)
 
 /**********************************************************************
  Add a new registry hook to the cache.  Note that the keyname
- is not in the exact format that a SORTED_TREE expects.
+ is not in the exact format that a struct sorted_tree expects.
  *********************************************************************/
 
 WERROR reghook_cache_add(const char *keyname, struct registry_ops *ops)