1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00

adt_tree: change pathtree_add to return WERR instead of bool.

Michael
This commit is contained in:
Michael Adam 2008-04-13 14:41:44 +02:00
parent e97d558c56
commit da45fb92f6
3 changed files with 10 additions and 10 deletions

View File

@ -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 */

View File

@ -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;
}
}

View File

@ -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);
}
/**********************************************************************