Commit 265ff835 by Richard Stallman

(xmalloc): New function.

From-SVN: r5521
parent 0ce958d0
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment