src/core/alloc_func.cpp
author rubidium
Sun, 25 May 2008 19:17:03 +0000
changeset 9354 845e07db4549
parent 9111 48ce04029fe4
permissions -rw-r--r--
(svn r13251) -Codechange: rename _patches to _settings as that is more logic.
-Codechange: move all Settings into substructs of _settings in a way that they are logically grouped.
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
9111
48ce04029fe4 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 8984
diff changeset
     3
/** @file alloc_func.cpp Functions to 'handle' memory allocation errors */
8537
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
 */
8984
68ef6bf69605 (svn r12778) -Codechange: add the NORETURN attribute to *allocError() functions
smatz
parents: 8537
diff changeset
    12
void NORETURN MallocError(size_t size)
8537
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
 */
8984
68ef6bf69605 (svn r12778) -Codechange: add the NORETURN attribute to *allocError() functions
smatz
parents: 8537
diff changeset
    21
void NORETURN ReallocError(size_t size)
8537
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
}