From d9222b83b44a999cc9241f85eb6ed2de9460db6e Mon Sep 17 00:00:00 2001 From: Kristin Date: Tue, 9 Dec 2025 10:27:18 +0100 Subject: [PATCH] =?UTF-8?q?highscore=20zum=20gitignore=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- bintree.c | 10 +--------- bintree.h | 2 -- highscores.txt | 4 ++-- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 80f665a..9e312e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ doble_initial.exe *.o -*.exe \ No newline at end of file +*.exe +highscore.txt \ No newline at end of file diff --git a/bintree.c b/bintree.c index a07d6e0..14632fa 100644 --- a/bintree.c +++ b/bintree.c @@ -13,14 +13,6 @@ // ordering. Accepts duplicates if isDuplicate is NULL, otherwise ignores // duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added). -void copyData(void *dest, const void *src, size_t size) { - unsigned char *d = dest; - const unsigned char *s = src; - for (size_t i = 0; i < size; i++) { - d[i] = s[i]; - } -} - TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, CompareFctType compareFct, int *isDuplicate) { @@ -33,7 +25,7 @@ TreeNode *addToTree(TreeNode *root, const void *data, size_t dataSize, if (root == NULL) { TreeNode *node = malloc(sizeof(TreeNode)); node->data = malloc(dataSize); - copyData(node->data, data, dataSize); + memcpy(node->data, data, dataSize); node->left = NULL; node->right = NULL; return node; diff --git a/bintree.h b/bintree.h index 1ced26b..9e6b45c 100644 --- a/bintree.h +++ b/bintree.h @@ -11,8 +11,6 @@ typedef struct node { struct node *right; } TreeNode; -void copyData(void *dest, const void *src, size_t size); - // Adds a copy of data's pointer destination to the tree using compareFct for // ordering. Accepts duplicates if isDuplicate is NULL, otherwise ignores // duplicates and sets isDuplicate to 1 (or to 0 if a new entry is added). diff --git a/highscores.txt b/highscores.txt index 2924551..aaac161 100644 --- a/highscores.txt +++ b/highscores.txt @@ -1,3 +1,5 @@ +Kristin;49209 +Kristin;9959 Kristin;9944 Kristin;7947 Kristin;6962 @@ -6,5 +8,3 @@ Kristin;5975 krisp;4986 krisp;4985 Kristin;4972 -player1;3999 -Kristin;3992