X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Falloc.c;h=816da2a055cfe25d21a135aacd5604a16f219d3b;hb=a6368763d08042207963c941b1c52b5fafcb0cb3;hp=4528e09757f16d4a00e444e1a33973921fcc5736;hpb=23264142feea939868c79d67f54bab0328ccc396;p=libucw.git diff --git a/ucw/alloc.c b/ucw/alloc.c index 4528e097..816da2a0 100644 --- a/ucw/alloc.c +++ b/ucw/alloc.c @@ -7,7 +7,7 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" +#include #include #include @@ -39,3 +39,13 @@ xfree(void *ptr) */ free(ptr); } + +void * +xrealloc(void *old, size_t size) +{ + /* We assume that realloc(NULL, x) works like malloc(x), which is true with the glibc. */ + void *x = realloc(old, size); + if (!x && size) + die("Cannot reallocate %zu bytes of memory", size); + return x; +}