/* Return a pointer to free()able block of memory large enough to hold BYTES number of bytes. If the memory cannot be allocated, print an error message and abort. */ void * xmalloc (size_t bytes) { void *temp = malloc (bytes); if (!temp) memory_error_and_abort ("xmalloc"); return (temp); }
void * xcalloc (unsigned int count, unsigned int bytes) { void *temp = (void *)calloc (count, bytes); if (!temp) memory_error_and_abort ("xcalloc"); return (temp); }
/* Return a pointer to free()able block of memory large enough to hold BYTES number of bytes. If the memory cannot be allocated, print an error message and abort. */ void * xmalloc (unsigned int bytes) { void *temp = (void *)malloc (bytes); if (!temp) memory_error_and_abort ("xmalloc"); return (temp); }
/* Return a pointer to free()able block of memory large enough to hold BYTES number of bytes. If the memory cannot be allocated, print an error message and abort. */ PTR_T xmalloc ( size_t bytes ) { PTR_T temp; temp = malloc (bytes); if (temp == 0) memory_error_and_abort ("xmalloc"); return (temp); }
PTR_T xrealloc ( PTR_T pointer, size_t bytes ) { PTR_T temp; temp = pointer ? realloc (pointer, bytes) : malloc (bytes); if (temp == 0) memory_error_and_abort ("xrealloc"); return (temp); }
void * xrealloc (void *pointer, unsigned int bytes) { void *temp; if (!pointer) temp = (void *)malloc (bytes); else temp = (void *)realloc (pointer, bytes); if (!temp) memory_error_and_abort ("xrealloc"); return (temp); }
void * xrealloc (void *pointer, size_t bytes) { void *temp; if (!pointer) temp = malloc (bytes); else temp = realloc (pointer, bytes); if (!temp) memory_error_and_abort ("xrealloc"); return (temp); }