From: Martin Mares Date: Tue, 2 Sep 2008 20:09:44 +0000 (+0200) Subject: Use size_t in xmalloc() and xrealloc(). X-Git-Tag: v5.0~125 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=e6688eeb82d349a202a30a243a59079bdc4c212d;p=libucw.git Use size_t in xmalloc() and xrealloc(). --- diff --git a/ucw/alloc.c b/ucw/alloc.c index 4f531366..4562b815 100644 --- a/ucw/alloc.c +++ b/ucw/alloc.c @@ -13,11 +13,11 @@ #include void * -xmalloc(uns size) +xmalloc(size_t size) { void *x = malloc(size); if (!x) - die("Cannot allocate %d bytes of memory", size); + die("Cannot allocate %zu bytes of memory", size); return x; } diff --git a/ucw/lib.h b/ucw/lib.h index 79843c0e..9612e6c7 100644 --- a/ucw/lib.h +++ b/ucw/lib.h @@ -159,8 +159,8 @@ void assert_failed_noinfo(void) NONRET; #define xrealloc ucw_xrealloc #define xfree ucw_xfree -void *xmalloc(uns) LIKE_MALLOC; /** Allocate memory and die() if there is none. **/ -void *xrealloc(void *, uns); /** Reallocate memory and die() if there is none. **/ +void *xmalloc(size_t) LIKE_MALLOC; /** Allocate memory and die() if there is none. **/ +void *xrealloc(void *, size_t); /** Reallocate memory and die() if there is none. **/ void xfree(void *); /** Free memory allocated by xmalloc() or xrealloc(). **/ void *xmalloc_zero(uns) LIKE_MALLOC; /** Allocate memory and fill it by zeroes. **/ diff --git a/ucw/realloc.c b/ucw/realloc.c index 51b50dec..66b001a2 100644 --- a/ucw/realloc.c +++ b/ucw/realloc.c @@ -12,11 +12,11 @@ #include void * -xrealloc(void *old, uns size) +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) - die("Cannot reallocate %d bytes of memory", size); + die("Cannot reallocate %zu bytes of memory", size); return x; }