]> mj.ucw.cz Git - libucw.git/blob - lib/alloc.c
dmalloc and efence work again (ported from rel-2.1 branch).
[libucw.git] / lib / alloc.c
1 /*
2  *      Sherlock Library -- Memory Allocation
3  *
4  *      (c) 2000 Martin Mares <mj@ucw.cz>
5  */
6
7 #include "lib/lib.h"
8
9 #include <stdlib.h>
10 #include <string.h>
11
12 #ifndef DMALLOC
13
14 void *
15 xmalloc(uns size)
16 {
17   void *x = malloc(size);
18   if (!x)
19     die("Cannot allocate %d bytes of memory", size);
20   return x;
21 }
22
23 #endif
24
25 void *
26 xmalloc_zero(uns size)
27 {
28   void *x = xmalloc(size);
29   bzero(x, size);
30   return x;
31 }