Remove toArray function

This commit is contained in:
Tobias Linz committed 2026-11-18 22:47:47 +01:00
1 parent 6ec27077c8
commit e06119912a
3 files changed
-26

No files matched your search

-16
View File
@@ -114,19 +114,3 @@ unsigned int treeSize(const TreeNode *const root)
return treeSize(root->left) + treeSize(root->right) + 1;
}
void *toArray(TreeNode *const root, const size_t dataSize) {
if (root == NULL) return NULL;
const unsigned int elementCount = treeSize(root);
unsigned char *array = calloc(elementCount, dataSize);
if (array == NULL) return NULL;
unsigned int index = 0;
for (void *element = nextTreeData(root); element != NULL && index < elementCount; element = nextTreeData(NULL)) {
memcpy(array + index * dataSize, element, dataSize);
index++;
}
return array;
}