rnd-19981109-2
[rocksndiamonds.git] / src / misc.c
index c560ae4bc0f6c3ae2931b82d5d5a9f5a4f9e39f6..a7e52dcc4a71aaf2273ae986ec1ff2551ed46a50 100644 (file)
@@ -446,6 +446,18 @@ void *checked_malloc(unsigned long size)
   return ptr;
 }
 
+void *checked_calloc(unsigned long size)
+{
+  void *ptr;
+
+  ptr = calloc(1, size);
+
+  if (ptr == NULL)
+    Error(ERR_EXIT, "cannot allocate %d bytes -- out of memory", size);
+
+  return ptr;
+}
+
 #define TRANSLATE_KEYSYM_TO_KEYNAME    0
 #define TRANSLATE_KEYSYM_TO_X11KEYNAME 1
 #define TRANSLATE_X11KEYNAME_TO_KEYSYM 2