Skip to content
Snippets Groups Projects
Commit 13276ff9 authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

*** empty log message ***

parent 4c7a306f
No related branches found
No related tags found
No related merge requests found
...@@ -180,7 +180,6 @@ SmoothData.o: SmoothData.cpp SmoothData.h ../Numeric/Numeric.h \ ...@@ -180,7 +180,6 @@ SmoothData.o: SmoothData.cpp SmoothData.h ../Numeric/Numeric.h \
StringUtils.o: StringUtils.cpp StringUtils.h StringUtils.o: StringUtils.cpp StringUtils.h
ListUtils.o: ListUtils.cpp MallocUtils.h ListUtils.h TreeUtils.h avl.h \ ListUtils.o: ListUtils.cpp MallocUtils.h ListUtils.h TreeUtils.h avl.h \
Message.h Message.h
TreeUtils.o: TreeUtils.cpp MallocUtils.h TreeUtils.h avl.h ListUtils.h \ TreeUtils.o: TreeUtils.cpp MallocUtils.h TreeUtils.h avl.h ListUtils.h
Message.h
avl.o: avl.cpp avl.h MallocUtils.h avl.o: avl.cpp avl.h MallocUtils.h
MallocUtils.o: MallocUtils.cpp MallocUtils.h Message.h MallocUtils.o: MallocUtils.cpp MallocUtils.h Message.h
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <string.h> #include <string.h>
#include "MallocUtils.h" #include "MallocUtils.h"
#include "TreeUtils.h" #include "TreeUtils.h"
#include "Message.h"
Tree_T *Tree_Create(int size, int (*fcmp) (const void *a, const void *b)) Tree_T *Tree_Create(int size, int (*fcmp) (const void *a, const void *b))
{ {
...@@ -28,15 +27,13 @@ void Tree_Delete(Tree_T * tree) ...@@ -28,15 +27,13 @@ void Tree_Delete(Tree_T * tree)
Free(tree); Free(tree);
} }
void Tree_Add(Tree_T * tree, void *data) void *Tree_Add(Tree_T * tree, void *data)
{ {
if(!tree) if(!tree) return 0;
Msg::Error("Impossible to add in unallocated tree"); void *ptr = Malloc(tree->size);
else { memcpy(ptr, data, tree->size);
void *ptr = Malloc(tree->size); avl_insert(tree->root, ptr, ptr);
memcpy(ptr, data, tree->size); return ptr;
avl_insert(tree->root, ptr, ptr);
}
} }
int Tree_Nbr(Tree_T * tree) int Tree_Nbr(Tree_T * tree)
......
...@@ -16,7 +16,7 @@ typedef struct { ...@@ -16,7 +16,7 @@ typedef struct {
Tree_T *Tree_Create(int size, int (*fcmp)(const void *a, const void *b)); Tree_T *Tree_Create(int size, int (*fcmp)(const void *a, const void *b));
void Tree_Delete(Tree_T *Tree); 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_Nbr(Tree_T *Tree);
int Tree_Insert(Tree_T *Tree, void *data); int Tree_Insert(Tree_T *Tree, void *data);
int Tree_Search(Tree_T *Tree, void *data); int Tree_Search(Tree_T *Tree, void *data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment