Fix format strings for size_t
This commit is contained in:
parent
92f5bdce14
commit
61f8ab527c
20
src/heap.c
20
src/heap.c
@ -33,8 +33,8 @@ debugging_calloc(size_t nmemb, size_t size, const char *file,
|
|||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
ptr = calloc(nmemb, size);
|
ptr = calloc(nmemb, size);
|
||||||
fprintf(stderr, "{calloc: %p:%u x %u} %s:%lu\n", ptr, nmemb, size, file,
|
fprintf(stderr, "{calloc: %p:%zu x %zu} %s:%lu\n",
|
||||||
line);
|
ptr, nmemb, size, file, line);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,8 @@ debugging_malloc(size_t size, const char *file, unsigned long line)
|
|||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
ptr = malloc(size);
|
ptr = malloc(size);
|
||||||
fprintf(stderr, "{malloc: %p:%u} %s:%lu\n", ptr, size, file, line);
|
fprintf(stderr, "{malloc: %p:%zu} %s:%lu\n",
|
||||||
|
ptr, size, file, line);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,12 +55,12 @@ void *
|
|||||||
debugging_realloc(void *ptr, size_t size, const char *file, unsigned long line)
|
debugging_realloc(void *ptr, size_t size, const char *file, unsigned long line)
|
||||||
{
|
{
|
||||||
void *newptr;
|
void *newptr;
|
||||||
|
|
||||||
assert(size > 0);
|
assert(size > 0);
|
||||||
|
|
||||||
newptr = realloc(ptr, size);
|
newptr = realloc(ptr, size);
|
||||||
fprintf(stderr, "{realloc: %p -> %p:%u} %s:%lu\n", ptr, newptr, size,
|
fprintf(stderr, "{realloc: %p -> %p:%zu} %s:%lu\n",
|
||||||
file, line);
|
ptr, newptr, size, file, line);
|
||||||
return newptr;
|
return newptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ debugging_free(void *ptr, const char *file, unsigned long line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
char*
|
char*
|
||||||
debugging_strdup(const char* s, const char* file, unsigned long line)
|
debugging_strdup(const char *s, const char *file, unsigned long line)
|
||||||
{
|
{
|
||||||
char* ptr;
|
char* ptr;
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -87,7 +88,8 @@ debugging_strdup(const char* s, const char* file, unsigned long line)
|
|||||||
return NULL;
|
return NULL;
|
||||||
memcpy(ptr, s, len);
|
memcpy(ptr, s, len);
|
||||||
|
|
||||||
fprintf(stderr, "{strdup: %p:%u} %s:%lu\n", ptr, len, file, line);
|
fprintf(stderr, "{strdup: %p:%zu} %s:%lu\n",
|
||||||
|
ptr, len, file, line);
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user