aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-09-28 23:23:24 +0000
committerRichard Stallman <rms@gnu.org>1993-09-28 23:23:24 +0000
commit265ff835ce55d2f468610ea47f4cdb701f1d3c8f (patch)
treeaee21c258167e3d479e3a441aa9d41ab540e4066 /gcc
parent0ce958d05974a1f56585e9bc6faeaa11f3e09458 (diff)
downloadgcc-265ff835ce55d2f468610ea47f4cdb701f1d3c8f.zip
gcc-265ff835ce55d2f468610ea47f4cdb701f1d3c8f.tar.gz
gcc-265ff835ce55d2f468610ea47f4cdb701f1d3c8f.tar.bz2
(xmalloc): New function.
From-SVN: r5521
Diffstat (limited to 'gcc')
-rw-r--r--gcc/bi-opcode.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/bi-opcode.c b/gcc/bi-opcode.c
index 772b1fe..f453789 100644
--- a/gcc/bi-opcode.c
+++ b/gcc/bi-opcode.c
@@ -51,3 +51,20 @@ enum bytecode_opcode\n{");
return 0;
}
+
+/* Safely allocate NBYTES bytes of memory. Returns pointer to block of
+ memory. */
+char *
+xmalloc (nbytes)
+ int nbytes;
+{
+ char *tmp = (char *) malloc (nbytes);
+
+ if (!tmp)
+ {
+ fprintf (stderr, "can't allocate %d bytes (out of virtual memory)\n", nbytes);
+ exit (1);
+ }
+
+ return tmp;
+}