Added xrealloc
git-svn-id: svn://svn.cc65.org/cc65/trunk@677 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* */
|
/* */
|
||||||
/* (C) 2000 Ullrich von Bassewitz */
|
/* (C) 2000-2001 Ullrich von Bassewitz */
|
||||||
/* Wacholderweg 14 */
|
/* Wacholderweg 14 */
|
||||||
/* D-70597 Stuttgart */
|
/* D-70597 Stuttgart */
|
||||||
/* EMail: uz@musoftware.de */
|
/* EMail: uz@musoftware.de */
|
||||||
@@ -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)
|
void xfree (const void* Block)
|
||||||
/* Free the block, do some debugging */
|
/* Free the block, do some debugging */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,9 @@
|
|||||||
void* xmalloc (size_t Size);
|
void* xmalloc (size_t Size);
|
||||||
/* Allocate memory, check for out of memory condition. Do some debugging */
|
/* 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);
|
void xfree (const void* Block);
|
||||||
/* Free the block, do some debugging */
|
/* Free the block, do some debugging */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user