commit 729df2ed3e0a67381310bc77f26e69838792c7b1
Author: Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Mon Aug 21 11:36:13 2017 +0200
Commit: Fabian Greffrath <fabian@greffrath.com>
CommitDate: Wed Aug 23 08:42:53 2017 +0200
i_system: Add an I_Realloc() function
---
src/i_system.c | 22 ++++++++++++++++++++++
src/i_system.h | 2 ++
2 files changed, 24 insertions(+)
diff --git a/src/i_system.c b/src/i_system.c
index c783d491..be8db177 100644
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -451,6 +451,28 @@ void I_Error (char *error, ...)
exit(-1);
}
+//
+// 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.
//
diff --git a/src/i_system.h b/src/i_system.h
index b65daff0..049774a7 100644
--- a/src/i_system.h
+++ b/src/i_system.h
@@ -56,6 +56,8 @@ void I_Error (char *error, ...);
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.