author | smatz |
Mon, 11 Feb 2008 20:23:38 +0000 | |
changeset 8537 | 14be8ee6a268 |
child 8984 | 68ef6bf69605 |
permissions | -rw-r--r-- |
8537
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
1 |
/* $Id$ */ |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
2 |
|
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
3 |
/** @file alloc_func.cpp functions to 'handle' memory allocation errors */ |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
4 |
|
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
5 |
#include "../stdafx.h" |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
6 |
#include "alloc_func.hpp" |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
7 |
|
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
8 |
/** |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
9 |
* Function to exit with an error message after malloc() or calloc() have failed |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
10 |
* @param size number of bytes we tried to allocate |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
11 |
*/ |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
12 |
void MallocError(size_t size) |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
13 |
{ |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
14 |
error("Out of memory. Cannot allocate %i bytes", size); |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
15 |
} |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
16 |
|
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
17 |
/** |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
18 |
* Function to exit with an error message after realloc() have failed |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
19 |
* @param size number of bytes we tried to allocate |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
20 |
*/ |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
21 |
void ReallocError(size_t size) |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
22 |
{ |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
23 |
error("Out of memory. Cannot reallocate %i bytes", size); |
14be8ee6a268
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
24 |
} |