summaryrefslogtreecommitdiff
path: root/src/common/malloc.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-08-07 03:39:13 +0200
committerHaru <haru@dotalux.com>2014-08-07 05:37:38 +0200
commitc45e3fa9793a273a0eab40d1626bcda7d710552c (patch)
tree4f6c9d47770a15c8cbfe065f7ee9203f77e57022 /src/common/malloc.c
parentcaf89724767465ecf339c391bb6d7a937d563fb2 (diff)
downloadhercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.gz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.bz2
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.tar.xz
hercules-c45e3fa9793a273a0eab40d1626bcda7d710552c.zip
Corrected several format-string errors through the code
- Functions that expect a printf-style format string are now marked as such, so that gcc/clang will emit a warning warn you if you mismatch format string and arguments. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/malloc.c')
-rw-r--r--src/common/malloc.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/common/malloc.c b/src/common/malloc.c
index 3c9fa9c54..eae9ad423 100644
--- a/src/common/malloc.c
+++ b/src/common/malloc.c
@@ -241,7 +241,7 @@ void *mmalloc_(size_t size, const char *file, int line, const char *func) {
struct unit_head *head;
if (((long) size) < 0) {
- ShowError("mmalloc_: %d\n", size);
+ ShowError("mmalloc_: %"PRIdS"\n", size);
return NULL;
}
@@ -272,7 +272,8 @@ void *mmalloc_(size_t size, const char *file, int line, const char *func) {
*(long*)((char*)p + sizeof(struct unit_head_large) - sizeof(long) + size) = 0xdeadbeaf;
return (char *)p + sizeof(struct unit_head_large) - sizeof(long);
} else {
- ShowFatalError("Memory manager::memmgr_alloc failed (allocating %d+%d bytes at %s:%d).\n", sizeof(struct unit_head_large), size, file, line);
+ ShowFatalError("Memory manager::memmgr_alloc failed (allocating %"PRIuS"+%"PRIuS" bytes at %s:%d).\n",
+ sizeof(struct unit_head_large), size, file, line);
exit(EXIT_FAILURE);
}
}
@@ -760,10 +761,10 @@ void memmgr_report (int extra) {
ShowMessage("[malloc] : reporting %u instances | %.2f MB\n",count,(double)((size)/1024)/1024);
ShowMessage("[malloc] : internal usage %.2f MB | %.2f MB\n",(double)((memmgr_usage_bytes_t-memmgr_usage_bytes)/1024)/1024,(double)((memmgr_usage_bytes_t)/1024)/1024);
- if( extra ) {
- ShowMessage("[malloc] : unit_head_large: %d bytes\n",sizeof(struct unit_head_large));
- ShowMessage("[malloc] : unit_head: %d bytes\n",sizeof(struct unit_head));
- ShowMessage("[malloc] : block: %d bytes\n",sizeof(struct block));
+ if (extra) {
+ ShowMessage("[malloc] : unit_head_large: %"PRIuS" bytes\n", sizeof(struct unit_head_large));
+ ShowMessage("[malloc] : unit_head: %"PRIuS" bytes\n", sizeof(struct unit_head));
+ ShowMessage("[malloc] : block: %"PRIuS" bytes\n", sizeof(struct block));
}
}