forked from freudenreichan/info2Praktikum-DobleSpiel
Polish bintree.c and implement tests
This commit is contained in:
3 files changed
+135
-11
No files matched your search
+4
-1
@@ -6,7 +6,7 @@
|
||||
// if isDuplicate is NULL, otherwise ignores duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added).
|
||||
TreeNode *addToTree(TreeNode *root, const void *const data, const size_t dataSize, const CompareFctType compareFct, int *isDuplicate)
|
||||
{
|
||||
if(data == NULL || dataSize == 0 || compareFct == NULL)
|
||||
if(data == NULL || dataSize == 0)
|
||||
return root;
|
||||
|
||||
if(root == NULL)
|
||||
@@ -35,6 +35,9 @@ TreeNode *addToTree(TreeNode *root, const void *const data, const size_t dataSiz
|
||||
return root;
|
||||
}
|
||||
|
||||
if(compareFct == NULL)
|
||||
return root;
|
||||
|
||||
const int comparisonValue = compareFct(data, root->data);
|
||||
|
||||
if(comparisonValue > 0)
|
||||
|
||||
Reference in new issue
Block a user