#include "memdebug.h"
struct memdebug {
- int size;
+ size_t size;
double mem[1];
/* I'm hoping this is the thing with the strictest alignment
* requirements. That also means we waste some space :-( */
}
if(logfile && source)
- fprintf(logfile, "MEM %s:%d malloc(%d) = %p\n",
+ fprintf(logfile, "MEM %s:%d malloc(%zd) = %p\n",
source, line, wantedsize, mem->mem);
return mem->mem;
}
memcpy(mem, str, len);
if(logfile)
- fprintf(logfile, "MEM %s:%d strdup(%p) (%d) = %p\n",
+ fprintf(logfile, "MEM %s:%d strdup(%p) (%zd) = %p\n",
source, line, str, len, mem);
return mem;
mem=(struct memdebug *)(realloc)(mem, size);
if(logfile)
- fprintf(logfile, "MEM %s:%d realloc(0x%x, %d) = %p\n",
+ fprintf(logfile, "MEM %s:%d realloc(0x%x, %zd) = %p\n",
source, line, ptr, wantedsize, mem?mem->mem:NULL);
if(mem) {