]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
(xalloc): New function.
authorNiels Möller <nisse@lysator.liu.se>
Sat, 7 Feb 2004 12:27:02 +0000 (13:27 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Sat, 7 Feb 2004 12:27:02 +0000 (13:27 +0100)
Rev: src/nettle/examples/io.c:1.7
Rev: src/nettle/examples/io.h:1.4

examples/io.c
examples/io.h

index 2cab495b9a22a50fb88596de2564d38343cefea2..148615960bb3938d945e0f8910503bcea8391d21 100644 (file)
 
 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, ...)
 {
index acd864f2754d31b5beecad49a6673febac6c5482..a5211951dcb561e9923cb30415f574646e034ac3 100644 (file)
@@ -34,6 +34,9 @@
 
 extern int quiet_flag;
 
+void *
+xalloc(size_t size);
+
 void
 werror(const char *format, ...)
 #if __GNUC___