From: Niels Möller Date: Sat, 7 Feb 2004 12:27:02 +0000 (+0100) Subject: (xalloc): New function. X-Git-Tag: nettle_1.9_release_20040207~15 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a45c20c85be2899a01056612ed4c7d2720513667;p=thirdparty%2Fnettle.git (xalloc): New function. Rev: src/nettle/examples/io.c:1.7 Rev: src/nettle/examples/io.h:1.4 --- diff --git a/examples/io.c b/examples/io.c index 2cab495b..14861596 100644 --- a/examples/io.c +++ b/examples/io.c @@ -37,6 +37,19 @@ 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 werror(const char *format, ...) { diff --git a/examples/io.h b/examples/io.h index acd864f2..a5211951 100644 --- a/examples/io.h +++ b/examples/io.h @@ -34,6 +34,9 @@ extern int quiet_flag; +void * +xalloc(size_t size); + void werror(const char *format, ...) #if __GNUC___