X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Falloc.c;h=816da2a055cfe25d21a135aacd5604a16f219d3b;hb=6c4c397f94ec5f5df6bcc178fb5fa4e84d3505fc;hp=c4e40640e764a98ba6bf923af6885b03dc26e9f1;hpb=fa7aa6d9457616ce28f97c83eaa616d0ff276870;p=libucw.git diff --git a/ucw/alloc.c b/ucw/alloc.c index c4e40640..816da2a0 100644 --- a/ucw/alloc.c +++ b/ucw/alloc.c @@ -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; +}