aboutsummaryrefslogtreecommitdiff
path: root/sys.cpp
diff options
context:
space:
mode:
authorLionel Ulmer2002-05-01 17:16:47 +0000
committerLionel Ulmer2002-05-01 17:16:47 +0000
commit7fa28ffec2e842cbc7a4404d75509288afa9995e (patch)
tree146d45d918090a29e7e337af3a9942bef2b99192 /sys.cpp
parent75f0674e465e628a9a6a5a7cc56e45609ac2e6d3 (diff)
downloadscummvm-rg350-7fa28ffec2e842cbc7a4404d75509288afa9995e.tar.gz
scummvm-rg350-7fa28ffec2e842cbc7a4404d75509288afa9995e.tar.bz2
scummvm-rg350-7fa28ffec2e842cbc7a4404d75509288afa9995e.zip
Removed ScummVM's private alloc / free / realloc functions. If I break
something, just yell :-) svn-id: r4160
Diffstat (limited to 'sys.cpp')
-rw-r--r--sys.cpp41
1 files changed, 1 insertions, 40 deletions
diff --git a/sys.cpp b/sys.cpp
index 7ac1db91d6..e7b5437bba 100644
--- a/sys.cpp
+++ b/sys.cpp
@@ -201,50 +201,11 @@ uint32 Scumm::fileReadDwordBE(void *handle)
return (b << 16) | a;
}
-byte *Scumm::alloc(int size)
-{
- byte *me = (byte *)::calloc(size + 4, 1);
- if (me == NULL)
- return NULL;
-
- *((uint32 *)me) = 0xDEADBEEF;
- return me + 4;
-}
-
-void Scumm::free(void *mem)
-{
- if (mem) {
- byte *me = (byte *)mem - 4;
- if (*((uint32 *)me) != 0xDEADBEEF) {
- error("Freeing invalid block.");
- }
-
- *((uint32 *)me) = 0xC007CAFE;
- ::free(me);
- }
-}
-
-byte *Scumm::realloc(void *mem, int size)
-{
- byte * me = (byte *) mem;
- if (mem) {
- if (size) {
- me = (byte *) ::realloc((me - 4), size + 4);
- return me + 4;
- } else {
- free(me);
- return NULL;
- }
- } else {
- return alloc(size);
- }
-}
-
char *Scumm::Strdup(const char *s)
{
if (s) {
int l = strlen(s) + 1;
- char * r = (char *) alloc(l);
+ char * r = (char *) malloc(l);
memcpy(r, s, l);
return r;
}