adt_tree: change pathtree_add to return WERR instead of bool.
authorMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 12:41:44 +0000 (14:41 +0200)
committerMichael Adam <obnox@samba.org>
Sun, 13 Apr 2008 13:33:47 +0000 (15:33 +0200)
Michael
(This used to be commit da45fb92f69221758f36db4cbb7d871e3ce60718)

source3/include/adt_tree.h
source3/lib/adt_tree.c
source3/registry/reg_cachehook.c

index 3e2f10001e280e078f8010244e4ba87bd91e896c..3acda8edb89301ef77ed5a575f3ee5564004bd2a 100644 (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 */
 
index ef72ba3e70c517c07141d6915632fc3b13b3c870..6ac498d9e62ae0884471ca16c85a4fcb55efdaf7 100644 (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;
                        }
                }
index db07330820dbac2976706e18f22f8a6fd7fddc24..f407f310f74b636bb295ea91af62fc6521622ef5 100644 (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);
 }
 
 /**********************************************************************