author | rubidium |
Wed, 16 Jul 2008 16:05:52 +0000 | |
branch | 0.6 |
changeset 11152 | b56fd5acecaf |
parent 9033 | 7153b87990f8 |
child 10246 | 707c09e2e42b |
permissions | -rw-r--r-- |
9033
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
1 |
/* $Id$ */ |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
2 |
|
7153b87990f8
(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 */ |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
4 |
|
7153b87990f8
(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" |
7153b87990f8
(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" |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
7 |
|
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
8 |
/** |
7153b87990f8
(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 |
7153b87990f8
(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 |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
11 |
*/ |
7153b87990f8
(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) |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
13 |
{ |
7153b87990f8
(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); |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
15 |
} |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
16 |
|
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
17 |
/** |
7153b87990f8
(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 |
7153b87990f8
(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 |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
20 |
*/ |
7153b87990f8
(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) |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
22 |
{ |
7153b87990f8
(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); |
7153b87990f8
(svn r12115) -Codechange: move malloc/realloc error messages to separate file to spare 4-8kB of binary size
smatz
parents:
diff
changeset
|
24 |
} |