/*****************************************************************************/ /* */ /* UNIT: NTL0_ckrealloc (Level 0 library routine) */ /* */ /* Author: Nikola Stojanovic */ /* */ /* Revision: 27 JUN 94 Version 1.0 */ /* */ /* Function: */ /* */ /* Procedure reallocates the memory buffer pointed to by the provided */ /* pointer into newly allocated storage of the requested size and returns */ /* pointer to the new memory area; if reallocation could not have been done, */ /* the procedure forces program exit, so it never returns NULL */ /* */ /*****************************************************************************/ #include #include #include "ntl0.h" /*****************************************************************************/ char *NTL0_ckrealloc (char *old_ptr, long int amount) { char *storage; if ((storage = (char *) realloc (old_ptr, (unsigned) amount)) == NULL) { fprintf (stderr, "Ran out of memory."); exit (1); /* Terminate program */ } else return storage; }