From e6688eeb82d349a202a30a243a59079bdc4c212d Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Tue, 2 Sep 2008 22:09:44 +0200 Subject: [PATCH] Use size_t in xmalloc() and xrealloc(). --- ucw/alloc.c | 4 ++-- ucw/lib.h | 4 ++-- ucw/realloc.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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; } -- 2.39.2