From 238e3ffb3486e4f25e4f60b1bc2a61034178ed60 Mon Sep 17 00:00:00 2001 From: Mathew Mrosko Date: Mon, 16 Nov 2009 21:49:19 +0530 Subject: Fix format string warnings C90 doesn't support z modifier in printf's, so cast values to (unsigned long) which should be the same size as size_t on both ILP32 and LP64. --- src/heap.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/heap.c b/src/heap.c index e71b9ab..c7d8560 100644 --- a/src/heap.c +++ b/src/heap.c @@ -38,8 +38,8 @@ void *debugging_calloc (size_t nmemb, size_t size, const char *file, assert (size > 0); ptr = calloc (nmemb, size); - fprintf (stderr, "{calloc: %p:%zu x %zu} %s:%lu\n", ptr, nmemb, size, - file, line); + fprintf (stderr, "{calloc: %p:%lu x %lu} %s:%lu\n", ptr, + (unsigned long) nmemb, (unsigned long) size, file, line); return ptr; } @@ -50,7 +50,8 @@ void *debugging_malloc (size_t size, const char *file, unsigned long line) assert (size > 0); ptr = malloc (size); - fprintf (stderr, "{malloc: %p:%zu} %s:%lu\n", ptr, size, file, line); + fprintf (stderr, "{malloc: %p:%lu} %s:%lu\n", ptr, + (unsigned long) size, file, line); return ptr; } @@ -62,8 +63,8 @@ void *debugging_realloc (void *ptr, size_t size, const char *file, assert (size > 0); newptr = realloc (ptr, size); - fprintf (stderr, "{realloc: %p -> %p:%zu} %s:%lu\n", ptr, newptr, size, - file, line); + fprintf (stderr, "{realloc: %p -> %p:%lu} %s:%lu\n", ptr, newptr, + (unsigned long) size, file, line); return newptr; } @@ -89,7 +90,8 @@ char *debugging_strdup (const char *s, const char *file, unsigned long line) return NULL; memcpy (ptr, s, len); - fprintf (stderr, "{strdup: %p:%zu} %s:%lu\n", ptr, len, file, line); + fprintf (stderr, "{strdup: %p:%lu} %s:%lu\n", ptr, + (unsigned long) len, file, line); return ptr; } -- cgit v1.2.3