diff --git a/Common/Makefile b/Common/Makefile index d16491bb59c55481d052cefbd06df2526f8c22e0..e4317a60c3e557bfee0a89d016c9289bc7fd95a4 100644 --- a/Common/Makefile +++ b/Common/Makefile @@ -180,7 +180,6 @@ SmoothData.o: SmoothData.cpp SmoothData.h ../Numeric/Numeric.h \ StringUtils.o: StringUtils.cpp StringUtils.h ListUtils.o: ListUtils.cpp MallocUtils.h ListUtils.h TreeUtils.h avl.h \ Message.h -TreeUtils.o: TreeUtils.cpp MallocUtils.h TreeUtils.h avl.h ListUtils.h \ - Message.h +TreeUtils.o: TreeUtils.cpp MallocUtils.h TreeUtils.h avl.h ListUtils.h avl.o: avl.cpp avl.h MallocUtils.h MallocUtils.o: MallocUtils.cpp MallocUtils.h Message.h diff --git a/Common/TreeUtils.cpp b/Common/TreeUtils.cpp index 2b78b0e01e6df38e32a6be4755494185941418c6..82d6876a7cc2c410a476b5af573ccb1d2711daa0 100644 --- a/Common/TreeUtils.cpp +++ b/Common/TreeUtils.cpp @@ -11,7 +11,6 @@ #include <string.h> #include "MallocUtils.h" #include "TreeUtils.h" -#include "Message.h" Tree_T *Tree_Create(int size, int (*fcmp) (const void *a, const void *b)) { @@ -28,15 +27,13 @@ void Tree_Delete(Tree_T * tree) Free(tree); } -void Tree_Add(Tree_T * tree, void *data) +void *Tree_Add(Tree_T * tree, void *data) { - if(!tree) - Msg::Error("Impossible to add in unallocated tree"); - else { - void *ptr = Malloc(tree->size); - memcpy(ptr, data, tree->size); - avl_insert(tree->root, ptr, ptr); - } + if(!tree) return 0; + void *ptr = Malloc(tree->size); + memcpy(ptr, data, tree->size); + avl_insert(tree->root, ptr, ptr); + return ptr; } int Tree_Nbr(Tree_T * tree) diff --git a/Common/TreeUtils.h b/Common/TreeUtils.h index 587f9682871a2331c327b290e08a9b95a2f49566..b02cf6bdce35321080aeffb75509c7d0e7860539 100644 --- a/Common/TreeUtils.h +++ b/Common/TreeUtils.h @@ -16,7 +16,7 @@ typedef struct { Tree_T *Tree_Create(int size, int (*fcmp)(const void *a, const void *b)); void Tree_Delete(Tree_T *Tree); -void Tree_Add(Tree_T *tree, void *data); +void *Tree_Add(Tree_T *tree, void *data); int Tree_Nbr(Tree_T *Tree); int Tree_Insert(Tree_T *Tree, void *data); int Tree_Search(Tree_T *Tree, void *data);