summaryrefslogtreecommitdiffstats
path: root/xmalloc.c
diff options
context:
space:
mode:
authorpgen <p.gen.progs@gmail.com>2022-03-16 22:19:46 +0100
committerpgen <p.gen.progs@gmail.com>2022-03-16 22:19:46 +0100
commit4180e49bbf2240994fda51d9840027c7deeb1465 (patch)
treea2b45c645e5ddb47772f291deec5132054b2b748 /xmalloc.c
parent7f2dc2bdabc3f33f7eadce3469e6220e0d2db164 (diff)
Use the right format to print size_t values (C99)
Diffstat (limited to 'xmalloc.c')
-rw-r--r--xmalloc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/xmalloc.c b/xmalloc.c
index 5a7c3d1..157cfe7 100644
--- a/xmalloc.c
+++ b/xmalloc.c
@@ -67,8 +67,7 @@ xmalloc(size_t size)
if (allocated == NULL)
{
fprintf(stderr,
- "Error: Insufficient memory (attempt to malloc %lu bytes)\n",
- (unsigned long int)size);
+ "Error: Insufficient memory (attempt to malloc %zu bytes)\n", size);
exit(EXIT_FAILURE);
}
@@ -91,8 +90,7 @@ xcalloc(size_t n, size_t size)
if (allocated == NULL)
{
fprintf(stderr,
- "Error: Insufficient memory (attempt to calloc %lu bytes)\n",
- (unsigned long int)size);
+ "Error: Insufficient memory (attempt to calloc %zu bytes)\n", size);
exit(EXIT_FAILURE);
}
@@ -113,8 +111,8 @@ xrealloc(void * p, size_t size)
if (allocated == NULL && size > 0)
{
fprintf(stderr,
- "Error: Insufficient memory (attempt to xrealloc %lu bytes)\n",
- (unsigned long int)size);
+ "Error: Insufficient memory (attempt to xrealloc %zu bytes)\n",
+ size);
exit(EXIT_FAILURE);
}