aboutsummaryrefslogtreecommitdiffstats
path: root/colorize.c
diff options
context:
space:
mode:
authorGravatar Steven Schubiger <stsc@refcnt.org> 2019-02-24 21:45:41 +0100
committerGravatar Steven Schubiger <stsc@refcnt.org> 2019-02-24 21:45:41 +0100
commitc8d98f146989adf92c440e78b47b554b427ddf79 (patch)
treebfc3c3983548be23fd8f398717c7eab976db3280 /colorize.c
parent560d590ae0fdeadf437443a3fe20498e53a1ac0c (diff)
downloadcolorize-c8d98f146989adf92c440e78b47b554b427ddf79.tar.gz
colorize-c8d98f146989adf92c440e78b47b554b427ddf79.tar.bz2
*alloc_wrap_debug(): improve aligning of debug output
Diffstat (limited to 'colorize.c')
-rw-r--r--colorize.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/colorize.c b/colorize.c
index aad5e62..f91af67 100644
--- a/colorize.c
+++ b/colorize.c
@@ -1352,13 +1352,14 @@ realloc_wrap (void *ptr, size_t size)
return p;
}
#else
+static const char *const format_debug = "%s: %10s %7lu bytes [source file %s, line %5u]\n";
static void *
malloc_wrap_debug (size_t size, const char *file, unsigned int line)
{
void *p = malloc (size);
if (!p)
MEM_ALLOC_FAIL_DEBUG (file, line);
- fprintf (log, "%s: malloc'ed %lu bytes [source file %s, line %u]\n", program_name, (unsigned long)size, file, line);
+ fprintf (log, format_debug, program_name, "malloc'ed", (unsigned long)size, file, line);
return p;
}
@@ -1368,7 +1369,7 @@ calloc_wrap_debug (size_t nmemb, size_t size, const char *file, unsigned int lin
void *p = calloc (nmemb, size);
if (!p)
MEM_ALLOC_FAIL_DEBUG (file, line);
- fprintf (log, "%s: calloc'ed %lu bytes [source file %s, line %u]\n", program_name, (unsigned long)(nmemb * size), file, line);
+ fprintf (log, format_debug, program_name, "calloc'ed", (unsigned long)(nmemb * size), file, line);
return p;
}
@@ -1378,7 +1379,7 @@ realloc_wrap_debug (void *ptr, size_t size, const char *file, unsigned int line)
void *p = realloc (ptr, size);
if (!p)
MEM_ALLOC_FAIL_DEBUG (file, line);
- fprintf (log, "%s: realloc'ed %lu bytes [source file %s, line %u]\n", program_name, (unsigned long)size, file, line);
+ fprintf (log, format_debug, program_name, "realloc'ed", (unsigned long)size, file, line);
return p;
}
#endif /* !DEBUG */