From: Richard Stallman Date: Tue, 28 Sep 1993 23:23:24 +0000 (+0000) Subject: (xmalloc): New function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=265ff835ce55d2f468610ea47f4cdb701f1d3c8f;p=gcc.git (xmalloc): New function. From-SVN: r5521 --- diff --git a/gcc/bi-opcode.c b/gcc/bi-opcode.c index 772b1fed3ad..f453789dd4d 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; +}