From 01f4bd4f4d05e195911f4787f209b2ab6e2d8ab4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Sun, 13 Apr 2008 14:41:44 +0200 Subject: adt_tree: change pathtree_add to return WERR instead of bool. Michael (This used to be commit da45fb92f69221758f36db4cbb7d871e3ce60718) --- source3/include/adt_tree.h | 2 +- source3/lib/adt_tree.c | 12 ++++++------ source3/registry/reg_cachehook.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source3') diff --git a/source3/include/adt_tree.h b/source3/include/adt_tree.h index 3e2f10001e..3acda8edb8 100644 --- a/source3/include/adt_tree.h +++ b/source3/include/adt_tree.h @@ -47,7 +47,7 @@ SORTED_TREE* pathtree_init( void *data_p, int (cmp_fn)(void*, void*) ); /* add a new path component */ -bool pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ); +WERROR pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ); /* search path */ diff --git a/source3/lib/adt_tree.c b/source3/lib/adt_tree.c index ef72ba3e70..6ac498d9e6 100644 --- a/source3/lib/adt_tree.c +++ b/source3/lib/adt_tree.c @@ -191,23 +191,23 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key ) Add a new node into the tree given a key path and a blob of data *************************************************************************/ - bool pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ) + WERROR pathtree_add( SORTED_TREE *tree, const char *path, void *data_p ) { char *str, *base, *path2; TREE_NODE *current, *next; - bool ret = True; + WERROR ret = WERR_OK; DEBUG(8,("pathtree_add: Enter\n")); if ( !path || *path != '/' ) { DEBUG(0,("pathtree_add: Attempt to add a node with a bad path [%s]\n", path ? path : "NULL" )); - return False; + return WERR_INVALID_PARAM; } if ( !tree ) { DEBUG(0,("pathtree_add: Attempt to add a node to an uninitialized tree!\n")); - return False; + return WERR_INVALID_PARAM; } /* move past the first '/' */ @@ -216,7 +216,7 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key ) path2 = SMB_STRDUP( path ); if ( !path2 ) { DEBUG(0,("pathtree_add: strdup() failed on string [%s]!?!?!\n", path)); - return False; + return WERR_NOMEM; } @@ -244,7 +244,7 @@ static TREE_NODE* pathtree_find_child( TREE_NODE *node, char* key ) next = pathtree_birth_child( current, base ); if ( !next ) { DEBUG(0,("pathtree_add: Failed to create new child!\n")); - ret = False; + ret = WERR_NOMEM; goto done; } } diff --git a/source3/registry/reg_cachehook.c b/source3/registry/reg_cachehook.c index db07330820..f407f310f7 100644 --- a/source3/registry/reg_cachehook.c +++ b/source3/registry/reg_cachehook.c @@ -77,7 +77,7 @@ WERROR reghook_cache_init(void) bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops) { - bool ret; + WERROR werr; char *key = NULL; key = keyname_to_path(talloc_tos(), keyname); @@ -89,9 +89,9 @@ bool reghook_cache_add(const char *keyname, REGISTRY_OPS *ops) DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n", (void *)ops, key)); - ret = pathtree_add(cache_tree, key, ops); + werr = pathtree_add(cache_tree, key, ops); TALLOC_FREE(key); - return ret; + return W_ERROR_IS_OK(werr); } /********************************************************************** -- cgit