Commit a45c20c8 authored by Niels Möller's avatar Niels Möller
Browse files

(xalloc): New function.

Rev: src/nettle/examples/io.c:1.7
Rev: src/nettle/examples/io.h:1.4
parent 783474cf
...@@ -37,6 +37,19 @@ ...@@ -37,6 +37,19 @@
int quiet_flag = 0; int quiet_flag = 0;
void *
xalloc(size_t size)
{
void *p = malloc(size);
if (!p)
{
fprintf(stderr, "Virtual memory exhausted.\n");
abort();
}
return p;
}
void void
werror(const char *format, ...) werror(const char *format, ...)
{ {
......
...@@ -34,6 +34,9 @@ ...@@ -34,6 +34,9 @@
extern int quiet_flag; extern int quiet_flag;
void *
xalloc(size_t size);
void void
werror(const char *format, ...) werror(const char *format, ...)
#if __GNUC___ #if __GNUC___
......
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