From: Richard M. Stallman Date: Wed, 9 Jul 1997 19:20:34 +0000 (+0000) Subject: [C_ALLOCA] (xmalloc): New function. X-Git-Tag: emacs-20.1~1245 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0c76956f837b5ada147e69cda271f1b82f2f8d53;p=emacs.git [C_ALLOCA] (xmalloc): New function. --- diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 2e99e9d34ad..999be2c2a8c 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -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)