diff options
author | Marvin Borner | 2020-05-13 21:28:56 +0200 |
---|---|---|
committer | Marvin Borner | 2020-05-13 22:12:41 +0200 |
commit | a9c7529dcca845d98192ece62be70f752972216b (patch) | |
tree | 666d49ceb411a669abe6191151b2238fd7156c30 /src/kernel/lib/data/tree.c | |
parent | e1a6ed079303dc7d218f1d5326a13b6755781271 (diff) |
Replaced alloc.h with liballoc
And many more adaptions to the lib
Diffstat (limited to 'src/kernel/lib/data/tree.c')
-rw-r--r-- | src/kernel/lib/data/tree.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/kernel/lib/data/tree.c b/src/kernel/lib/data/tree.c index 65b8433..9758ec1 100644 --- a/src/kernel/lib/data/tree.c +++ b/src/kernel/lib/data/tree.c @@ -1,15 +1,16 @@ #include <lib/data.h> #include <memory/alloc.h> +#include <stddef.h> #include <stdint.h> struct tree *tree_create() { - return (struct tree *)kcalloc(sizeof(struct tree), 1); + return (struct tree *)calloc(sizeof(struct tree), 1); } struct tree_node *treenode_create(void *value) { - struct tree_node *n = kcalloc(sizeof(struct tree_node), 1); + struct tree_node *n = calloc(sizeof(struct tree_node), 1); n->value = value; n->children = list_create(); return n; @@ -17,7 +18,7 @@ struct tree_node *treenode_create(void *value) struct tree_node *tree_insert(struct tree *tree, struct tree_node *subroot, void *value) { - struct tree_node *treenode = kcalloc(sizeof(struct tree_node), 1); + struct tree_node *treenode = calloc(sizeof(struct tree_node), 1); treenode->children = list_create(); treenode->value = value; @@ -62,7 +63,7 @@ void tree_remove(struct tree *tree, struct tree_node *remove_node) struct tree_node *parent = tree_find_parent(tree, remove_node, &child_index); if (parent != NULL) { struct tree_node *freethis = list_remove_by_index(parent->children, child_index); - kfree(freethis); + free(freethis); } } |