1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-20 05:29:39 +00:00

Added xrealloc

git-svn-id: svn://svn.cc65.org/cc65/trunk@677 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz 2001-03-26 21:46:37 +00:00
parent c3e37a287a
commit 1ced0327ed
2 changed files with 24 additions and 4 deletions

View File

@ -6,10 +6,10 @@
/* */
/* */
/* */
/* (C) 2000 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@musoftware.de */
/* (C) 2000-2001 Ullrich von Bassewitz */
/* Wacholderweg 14 */
/* D-70597 Stuttgart */
/* EMail: uz@musoftware.de */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
@ -64,6 +64,23 @@ void* xmalloc (size_t Size)
void* xrealloc (void* P, size_t Size)
/* Reallocate a memory block, check for out of memory */
{
/* Reallocate the block */
void* N = realloc (P, Size);
/* Check for errors */
if (N == 0 && Size != 0) {
AbEnd ("Out of memory in realloc - requested block size = %lu", (unsigned long) Size);
}
/* Return the pointer to the new block */
return N;
}
void xfree (const void* Block)
/* Free the block, do some debugging */
{

View File

@ -51,6 +51,9 @@
void* xmalloc (size_t Size);
/* Allocate memory, check for out of memory condition. Do some debugging */
void* xrealloc (void* P, size_t Size);
/* Reallocate a memory block, check for out of memory */
void xfree (const void* Block);
/* Free the block, do some debugging */