adt_tree: Avoid WERROR.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 24 Mar 2012 15:41:35 +0000 (16:41 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 24 Mar 2012 15:41:35 +0000 (16:41 +0100)
source3/include/adt_tree.h
source3/lib/adt_tree.c
source3/registry/reg_cachehook.c

index c2a869b0f2704fab90920e23ad13fb6e4095d2ca..7e43fa60f6a154b9726b633393fde798fcb88f05 100644 (file)
@@ -32,7 +32,7 @@ struct sorted_tree *pathtree_init(void *data_p);
 
 /* add a new path component */
 
-WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p );
+bool pathtree_add(struct sorted_tree *tree, const char *path, void *data_p );
 
 /* search path */
 
index de7f2d2637277117a236df60bee78cf79bdd901d..a225796fc786622a32cfe73d46f49d41d389be70 100644 (file)
@@ -206,11 +206,11 @@ static struct tree_node *pathtree_find_child(struct tree_node *node,
  Add a new node into the tree given a key path and a blob of data
  *************************************************************************/
 
-WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p)
+bool pathtree_add(struct sorted_tree *tree, const char *path, void *data_p)
 {
        char *str, *base, *path2;
        struct tree_node *current, *next;
-       WERROR ret = WERR_OK;
+       bool ret = true;
 
        DEBUG(8,("pathtree_add: Enter\n"));
 
@@ -259,7 +259,7 @@ WERROR pathtree_add(struct sorted_tree *tree, const char *path, void *data_p)
                        next = pathtree_birth_child( current, base );
                        if ( !next ) {
                                DEBUG(0,("pathtree_add: Failed to create new child!\n"));
-                               ret = WERR_NOMEM;
+                               ret = false;
                                goto done;
                        }
                }
index dc07b51944e9a64ca6be736b0d7152733bcd7224..1f269276aab60ac287ffb78b291700b10521878c 100644 (file)
@@ -93,7 +93,10 @@ WERROR reghook_cache_add(const char *keyname, struct registry_ops *ops)
        DEBUG(10, ("reghook_cache_add: Adding ops %p for key [%s]\n",
                   (void *)ops, key));
 
-       werr = pathtree_add(cache_tree, key, ops);
+       if (!pathtree_add(cache_tree, key, ops))
+               werr = WERR_NOMEM;
+       else
+               werr = WERR_OK;
 
 done:
        TALLOC_FREE(key);