summaryrefslogtreecommitdiff
path: root/source3/lib/adt_tree.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-02-07 15:42:26 +0100
committerVolker Lendecke <vl@samba.org>2010-02-13 13:26:10 +0100
commitceebed6ce19a5821b01a30f6ebc47871b27b413a (patch)
treebae683e2cf22d599f84b5d5d2f2e29742c665636 /source3/lib/adt_tree.c
parent65b26ba985c0882a3380f8fdde8405d98df6de55 (diff)
downloadsamba-ceebed6ce19a5821b01a30f6ebc47871b27b413a.tar.gz
samba-ceebed6ce19a5821b01a30f6ebc47871b27b413a.tar.bz2
samba-ceebed6ce19a5821b01a30f6ebc47871b27b413a.zip
s3: TREE_NODE -> struct tree_node
Diffstat (limited to 'source3/lib/adt_tree.c')
-rw-r--r--source3/lib/adt_tree.c30
1 files changed, 18 insertions, 12 deletions
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" ));