]> mj.ucw.cz Git - libucw.git/blobdiff - lib/alloc.c
The StringMap file contains an end marker pointing past the last
[libucw.git] / lib / alloc.c
index 65594669234328ad0316a2b956d2434f815479b9..075321436c44f1dba1ffb54d5098d5248fd60b64 100644 (file)
@@ -1,19 +1,27 @@
 /*
  *     Sherlock Library -- Memory Allocation
  *
 /*
  *     Sherlock Library -- Memory Allocation
  *
- *     (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
+ *     (c) 2000 Martin Mares <mj@ucw.cz>
  */
 
  */
 
-#include <stdio.h>
-#include <stdlib.h>
+#include "lib/lib.h"
 
 
-#include "lib.h"
+#include <stdlib.h>
+#include <string.h>
 
 void *
 xmalloc(uns size)
 {
   void *x = malloc(size);
   if (!x)
 
 void *
 xmalloc(uns size)
 {
   void *x = malloc(size);
   if (!x)
-       die("Cannot allocate %d bytes of memory", size);
+    die("Cannot allocate %d bytes of memory", size);
+  return x;
+}
+
+void *
+xmalloc_zero(uns size)
+{
+  void *x = xmalloc(size);
+  bzero(x, size);
   return x;
 }
   return x;
 }