From 5b2cac6bf167a825684da433093b720e8b6523c7 Mon Sep 17 00:00:00 2001 From: Charadon Date: Sat, 10 Sep 2022 16:16:45 -0400 Subject: Replaced malloc and free with garbage collector versions. --- src/pong.h | 1 + src/title.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pong.h b/src/pong.h index d0099d4..310c45f 100644 --- a/src/pong.h +++ b/src/pong.h @@ -16,6 +16,7 @@ #include #include #include +#include #include "sounds.h" diff --git a/src/title.c b/src/title.c index 2183588..f909a9e 100644 --- a/src/title.c +++ b/src/title.c @@ -36,7 +36,7 @@ static int order_leaderboard() { struct LeaderboardEntries *TmpStore[UINT16_MAX*2]; int size = 0; for (size = 0; size < (UINT16_MAX*2); size++) /* If there's 131,000 entries, I dunno what to tell you. You really like pong... */ - TmpStore[size] = malloc(sizeof(struct LeaderboardEntries)); + TmpStore[size] = GC_malloc(sizeof(struct LeaderboardEntries)); if(*TmpStore == NULL) { /* Check if memory got assigned correctly. */ exit(1); } @@ -57,7 +57,7 @@ static int order_leaderboard() { /* Cleanup */ /* Free TmpStore */ - free(*TmpStore); /* Truth be told, I dunno if this even works, since the amount of memory used is kilobytes... */ + GC_free(*TmpStore); /* Truth be told, I dunno if this even works, since the amount of memory used is kilobytes... */ /* Close leaderboard file. */ if (LeaderboardFile != NULL) { fclose(LeaderboardFile); @@ -79,7 +79,7 @@ static void score_screen(Camera2D *MainCamera) { struct LeaderboardEntries *Scores[UINT16_MAX*2]; int size = 0; for (size = 0; size < (UINT16_MAX*2); size++) /* If there's 131,000 entries, I dunno what to tell you. You really like pong... */ - Scores[size] = malloc(sizeof(struct LeaderboardEntries)); + Scores[size] = GC_malloc(sizeof(struct LeaderboardEntries)); if(*Scores == NULL) { /* Check if memory got assigned correctly. */ exit(1); } -- cgit 1.4.1-2-gfad0