/*
* Sherlock Library -- Memory Allocation
*
- * (c) 1997 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
+ * (c) 2000 Martin Mares <mj@ucw.cz>
+ *
+ * This software may be freely distributed and used according to the terms
+ * of the GNU Lesser General Public License.
*/
-#include <stdio.h>
+#include "lib/lib.h"
+
#include <stdlib.h>
+#include <string.h>
-#include "lib.h"
+#ifndef DMALLOC
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;
+}
+
+#endif
+
+void *
+xmalloc_zero(uns size)
+{
+ void *x = xmalloc(size);
+ bzero(x, size);
return x;
}