about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorCharadon <dev@iotib.net>2022-09-10 16:16:45 -0400
committerCharadon <dev@iotib.net>2022-09-10 16:16:45 -0400
commit5b2cac6bf167a825684da433093b720e8b6523c7 (patch)
tree689c133a824dfd6f5066b393367ac41672dd9cc2 /src
parentcd61a586a10e9e3d8d7ec4b0e55ea6caad9dbe65 (diff)
downloadPong-C-5b2cac6bf167a825684da433093b720e8b6523c7.tar.gz
Replaced malloc and free with garbage collector versions.
Diffstat (limited to 'src')
-rw-r--r--src/pong.h1
-rw-r--r--src/title.c6
2 files changed, 4 insertions, 3 deletions
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 <string.h>
 #include <stdint.h>
 #include <stdlib.h>
+#include <gc.h>
 
 #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);
     }