[C_ALLOCA] (xmalloc): New function.

This commit is contained in:
Richard M. Stallman 1997-07-09 19:20:34 +00:00
parent b0f661deaa
commit 0c76956f83

View file

@ -137,6 +137,23 @@ quote_file_name (name)
return copy;
}
#ifdef C_ALLOCA
/* Like malloc but get fatal error if memory is exhausted. */
char *
xmalloc (size)
unsigned int size;
{
char *result = (char *) malloc (size);
if (result == NULL)
{
perror ("malloc");
exit (1);
}
return result;
}
#endif /* C_ALLOCA */
#if !defined (HAVE_SOCKETS) && !defined (HAVE_SYSVIPC)