Add a SZFMT macro for a size_t string formatter

This commit is contained in:
Chris Robinson 2014-04-19 09:42:03 -07:00
parent 043e25b602
commit bb969c3ccc
2 changed files with 11 additions and 2 deletions

View File

@ -89,7 +89,7 @@ static int readline(FILE *f, char **output, size_t *maxlen)
temp = realloc(*output, newmax);
if(!temp)
{
ERR("Failed to realloc %lu bytes from %lu!\n", newmax, *maxlen);
ERR("Failed to realloc "SZFMT" bytes from "SZFMT"!\n", newmax, *maxlen);
return 0;
}
@ -162,7 +162,7 @@ static char *expdup(const char *str)
temp = realloc(output, newmax);
if(!temp)
{
ERR("Failed to realloc %lu bytes from %lu!\n", newmax, maxlen);
ERR("Failed to realloc "SZFMT" bytes from "SZFMT"!\n", newmax, maxlen);
return output;
}

View File

@ -31,6 +31,15 @@
#endif
#endif
#if defined(_WIN64)
#define SZFMT "%I64u"
#elif defined(_WIN32)
#define SZFMT "%d"
#else
#define SZFMT "%zu"
#endif
#include "align.h"
#include "atomic.h"
#include "uintmap.h"