shithub: choc

Download patch

ref: 729df2ed3e0a67381310bc77f26e69838792c7b1
parent: 132a4d1603fd4142a6ad675384a3fdedb1d9ed66
author: Fabian Greffrath <fabian@greffrath.com>
date: Mon Aug 21 07:36:13 EDT 2017

i_system: Add an I_Realloc() function

--- a/src/i_system.c
+++ b/src/i_system.c
@@ -452,6 +452,28 @@
 }
 
 //
+// I_Realloc
+//
+
+void *I_Realloc(void *ptr, size_t size)
+{
+    void *new_ptr;
+
+    new_ptr = realloc(ptr, size);
+
+    if (size != 0 && new_ptr == NULL)
+    {
+        I_Error ("I_Realloc: failed on reallocation of %i bytes", size);
+    }
+    else
+    {
+        ptr = new_ptr;
+    }
+
+    return ptr;
+}
+
+//
 // Read Access Violation emulation.
 //
 // From PrBoom+, by entryway.
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -56,6 +56,8 @@
 
 void I_Tactile (int on, int off, int total);
 
+void *I_Realloc(void *ptr, size_t size);
+
 boolean I_GetMemoryValue(unsigned int offset, void *value, int size);
 
 // Schedule a function to be called when the program exits.