shithub: choc

Download patch

ref: 2317560862c377d7d6a842e1158948b038df119f
parent: 12cf8abde16bc7c47b78744a528a46b57be7adf5
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Aug 21 07:38:54 EDT 2017

replace calls to realloc() with the new I_Realloc()

--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -472,7 +472,7 @@
 {
     ++subst_music_len;
     subst_music =
-        realloc(subst_music, sizeof(subst_music_t) * subst_music_len);
+        I_Realloc(subst_music, sizeof(subst_music_t) * subst_music_len);
     memcpy(&subst_music[subst_music_len - 1], subst, sizeof(subst_music_t));
 }
 
--- a/src/midifile.c
+++ b/src/midifile.c
@@ -22,6 +22,7 @@
 
 #include "doomtype.h"
 #include "i_swap.h"
+#include "i_system.h"
 #include "midifile.h"
 
 #define HEADER_CHUNK_ID "MThd"
@@ -456,7 +457,7 @@
     {
         // Resize the track slightly larger to hold another event:
 
-        new_events = realloc(track->events, 
+        new_events = I_Realloc(track->events, 
                              sizeof(midi_event_t) * (track->num_events + 1));
 
         if (new_events == NULL)
--- a/src/net_query.c
+++ b/src/net_query.c
@@ -202,7 +202,7 @@
         return NULL;
     }
 
-    targets = realloc(targets, sizeof(query_target_t) * (num_targets + 1));
+    targets = I_Realloc(targets, sizeof(query_target_t) * (num_targets + 1));
 
     target = &targets[num_targets];
     target->type = QUERY_TARGET_SERVER;
--- a/src/w_checksum.c
+++ b/src/w_checksum.c
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 
+#include "i_system.h"
 #include "m_misc.h"
 #include "sha1.h"
 #include "w_checksum.h"
@@ -44,7 +45,7 @@
     // Not found in list.  This is a new file we haven't seen yet.
     // Allocate another slot for this file.
 
-    open_wadfiles = realloc(open_wadfiles,
+    open_wadfiles = I_Realloc(open_wadfiles,
                             sizeof(wad_file_t *) * (num_open_wadfiles + 1));
     open_wadfiles[num_open_wadfiles] = handle;
 
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -206,7 +206,7 @@
 
     startlump = numlumps;
     numlumps += numfilelumps;
-    lumpinfo = realloc(lumpinfo, numlumps * sizeof(lumpinfo_t *));
+    lumpinfo = I_Realloc(lumpinfo, numlumps * sizeof(lumpinfo_t *));
     if (lumpinfo == NULL)
     {
         W_CloseFile(wad_file);