Permalink
Browse files

Clean up some printf formats that Windows doesn't support.

  • Loading branch information...
Shawn
Shawn committed Oct 18, 2017
1 parent e9cf49f commit 300c3a928fc4ebe07005196388560bd1ec0367a1
Showing with 14 additions and 6 deletions.
  1. +2 −3 .gitignore
  2. +12 −3 src/mymalloc.c
View
@@ -8,6 +8,8 @@
*.patch
*.patch.txt
*.plist
core
*.core
Makefile
config.h
config.log
@@ -29,7 +31,6 @@ game/txt/events.txt
game/txt/help.txt
game/txt/news.txt
game/save
game/core
game/*.crt
game/*.csr
game/*.key
@@ -45,10 +46,8 @@ src/funlocal.c
src/info_slave
src/local.c
src/netmud
src/netmud~
src/ssl_slave
src/TAGS
src/*.exe
test/alltests.sh
test/testgame
third_party
View
@@ -38,6 +38,9 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef WIN32
#include <windows.h>
#endif
@@ -49,6 +52,12 @@
#include "memcheck.h"
#include "strutil.h"
#ifdef WIN32
#define SZT PRIu64
#else
#define SZT "zu"
#endif
/** A malloc wrapper that tracks type of allocation.
* This should be used in preference to malloc() when possible,
* to enable memory leak tracing with MEM_CHECK.
@@ -69,7 +78,7 @@ mush_malloc(size_t bytes, const char *check)
ptr = malloc(bytes);
if (!ptr)
do_rawlog(LT_TRACE, "mush_malloc failed to malloc %zu bytes for %s",
do_rawlog(LT_TRACE, "mush_malloc failed to malloc %" SZT " bytes for %s",
bytes, check);
add_check(check);
return ptr;
@@ -86,7 +95,7 @@ void *
mush_malloc_zero(size_t bytes, const char *check) {
void *ptr = calloc(bytes, 1);
if (!ptr)
do_rawlog(LT_TRACE, "mush_malloc_zero failed to allocate %zu bytes for %s",
do_rawlog(LT_TRACE, "mush_malloc_zero failed to allocate %" SZT " bytes for %s",
bytes, check);
add_check(check);
return ptr;
@@ -108,7 +117,7 @@ mush_calloc(size_t count, size_t size, const char *check)
ptr = calloc(count, size);
if (!ptr)
do_rawlog(LT_TRACE, "mush_calloc failed to allocate %zu bytes for %s",
do_rawlog(LT_TRACE, "mush_calloc failed to allocate %" SZT " bytes for %s",
size * count, check);
add_check(check);
return ptr;

0 comments on commit 300c3a9

Please sign in to comment.