summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1997-07-09 19:20:34 +0000
committerRichard M. Stallman <rms@gnu.org>1997-07-09 19:20:34 +0000
commit3260b98890f68fb3ff2c5d1ddecfb5f9b0df24c5 (patch)
tree2e42d5053c52eb9e173724e7fb9b6040bbedf449 /lib-src
parentb11644937e46027d76e6d21387fd1a11b1cd400d (diff)
downloademacs-3260b98890f68fb3ff2c5d1ddecfb5f9b0df24c5.tar.gz
[C_ALLOCA] (xmalloc): New function.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c17
1 files changed, 17 insertions, 0 deletions
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)