forked from aburch/simutrans
-
Notifications
You must be signed in to change notification settings - Fork 0
/
simmem.cc
35 lines (28 loc) · 789 Bytes
/
simmem.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright (c) 1997 - 2001 Hansjörg Malthaner
*
* This file is part of the Simutrans project under the artistic license.
* (see license.txt)
*/
#include <stdio.h> // since BeOS needs size_t from there ...
#include <stdlib.h>
#include "simmem.h"
#include "simdebug.h"
void* xmalloc(size_t const size)
{
void* const p = malloc(size);
if (!p) {
// use unified error handler instead, since BeOS need this as C style file!
dbg->fatal("xmalloc()", "Could not alloc %li bytes.", (long)size );
}
return p;
}
void* xrealloc(void* const ptr, size_t const size)
{
void* const p = realloc(ptr, size);
if (!p) {
// use unified error handler instead, since BeOS need this as C style file!
dbg->fatal("realloc()", "Could not alloc %li bytes.", (long)size );
}
return p;
}