commit 30e4e431399360b24ea34843da7e006985ff9e3c
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Aug 21 11:38:54 2017 +0200
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Wed Aug 23 08:42:54 2017 +0200
replace calls to realloc() with the new I_Realloc()
---
src/i_sdlmusic.c | 2 +-
src/midifile.c | 3 ++-
src/net_query.c | 2 +-
src/w_checksum.c | 3 ++-
src/w_wad.c | 2 +-
5 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/i_sdlmusic.c b/src/i_sdlmusic.c
index ca04218c..b70873f9 100644
--- a/src/i_sdlmusic.c
+++ b/src/i_sdlmusic.c
@@ -469,7 +469,7 @@ static void AddSubstituteMusic(subst_music_t *subst)
{
++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));
}
diff --git a/src/midifile.c b/src/midifile.c
index c103b5c8..78f3aa6c 100644
--- 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 @@ static boolean ReadTrack(midi_track_t *track, FILE *stream)
{
// 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)
diff --git a/src/net_query.c b/src/net_query.c
index d5288e25..eaa6f96d 100644
--- a/src/net_query.c
+++ b/src/net_query.c
@@ -202,7 +202,7 @@ static query_target_t *GetTargetForAddr(net_addr_t *addr, boolean create)
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;
diff --git a/src/w_checksum.c b/src/w_checksum.c
index bf959671..09d8d2a6 100644
--- 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 @@ static int GetFileNumber(wad_file_t *handle)
// 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;
diff --git a/src/w_wad.c b/src/w_wad.c
index 1c7e956e..5b6c24cb 100644
--- a/src/w_wad.c
+++ b/src/w_wad.c
@@ -206,7 +206,7 @@ wad_file_t *W_AddFile (char *filename)
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);