diff options
author | Volker Lendecke <vl@samba.org> | 2010-02-07 15:42:26 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-02-13 13:26:10 +0100 |
commit | ceebed6ce19a5821b01a30f6ebc47871b27b413a (patch) | |
tree | bae683e2cf22d599f84b5d5d2f2e29742c665636 /source3 | |
parent | 65b26ba985c0882a3380f8fdde8405d98df6de55 (diff) | |
download | samba-ceebed6ce19a5821b01a30f6ebc47871b27b413a.tar.gz samba-ceebed6ce19a5821b01a30f6ebc47871b27b413a.tar.bz2 samba-ceebed6ce19a5821b01a30f6ebc47871b27b413a.zip |
s3: TREE_NODE -> struct tree_node
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/adt_tree.h | 10 | ||||
-rw-r--r-- | source3/lib/adt_tree.c | 30 |
2 files changed, 23 insertions, 17 deletions
diff --git a/source3/include/adt_tree.h b/source3/include/adt_tree.h index 3acda8edb8..08c7791802 100644 --- a/source3/include/adt_tree.h +++ b/source3/include/adt_tree.h @@ -22,16 +22,16 @@ /* data structure used to build the tree */ -typedef struct _tree_node { - struct _tree_node *parent; - struct _tree_node **children; +struct tree_node { + struct tree_node *parent; + struct tree_node **children; int num_children; char *key; void *data_p; -} TREE_NODE; +}; typedef struct _tree_root { - TREE_NODE *root; + struct tree_node *root; /* not used currently (is it needed?) */ int (*compare)(void* x, void *y); diff --git a/source3/lib/adt_tree.c b/source3/lib/adt_tree.c index d97d12ef2d..bb918a8162 100644 --- a/source3/lib/adt_tree.c +++ b/source3/lib/adt_tree.c @@ -59,7 +59,8 @@ static bool trim_tree_keypath( char *path, char **base, char **new_path ) tree->compare = cmp_fn; - if ( !(tree->root = TALLOC_ZERO_P(tree, TREE_NODE)) ) { + tree->root = talloc_zero(tree, struct tree_node); + if (tree->root == NULL) { TALLOC_FREE( tree ); return NULL; } @@ -74,19 +75,23 @@ static bool trim_tree_keypath( char *path, char **base, char **new_path ) Find the next child given a key string *************************************************************************/ -static TREE_NODE* pathtree_birth_child( TREE_NODE *node, char* key ) +static struct tree_node *pathtree_birth_child(struct tree_node *node, + char* key ) { - TREE_NODE *infant = NULL; - TREE_NODE **siblings; + struct tree_node *infant = NULL; + struct tree_node **siblings; int i; - if ( !(infant = TALLOC_ZERO_P( node, TREE_NODE)) ) + infant = talloc_zero(node, struct tree_node); + if (infant == NULL) { return NULL; + } infant->key = talloc_strdup( infant, key ); infant->parent = node; - siblings = TALLOC_REALLOC_ARRAY( node, node->children, TREE_NODE *, node->num_children+1 ); + siblings = talloc_realloc(node, node->children, struct tree_node *, + node->num_children+1); if ( siblings ) node->children = siblings; @@ -147,9 +152,10 @@ static TREE_NODE* pathtree_birth_child( TREE_NODE *node, char* key ) Find the next child given a key string *************************************************************************/ -static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key ) +static struct tree_node *pathtree_find_child(struct tree_node *node, + char *key ) { - TREE_NODE *next = NULL; + struct tree_node *next = NULL; int i, result; if ( !node ) { @@ -193,7 +199,7 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key ) WERROR pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ) { char *str, *base, *path2; - TREE_NODE *current, *next; + struct tree_node *current, *next; WERROR ret = WERR_OK; DEBUG(8,("pathtree_add: Enter\n")); @@ -274,11 +280,11 @@ done: /************************************************************************** - Recursive routine to print out all children of a TREE_NODE + Recursive routine to print out all children of a struct tree_node *************************************************************************/ static void pathtree_print_children(TALLOC_CTX *ctx, - TREE_NODE *node, + struct tree_node *node, int debug, const char *path ) { @@ -345,7 +351,7 @@ static void pathtree_print_children(TALLOC_CTX *ctx, void* pathtree_find( SORTED_TREE *tree, char *key ) { char *keystr, *base = NULL, *str = NULL, *p; - TREE_NODE *current; + struct tree_node *current; void *result = NULL; DEBUG(10,("pathtree_find: Enter [%s]\n", key ? key : "NULL" )); |