[clang] Avoid a nested function in heap_wrapper.c

This GCC extension is not supported by clang and in this case is not
necessary. Move the function to the top level to avoid the syntax error.
This commit is contained in:
Alex Richardson
2021-12-09 11:02:59 +00:00
committed by Travis Geiselbrecht
parent 28c615456c
commit e40ac2a883

View File

@@ -89,6 +89,10 @@ static inline void *HEAP_CALLOC(size_t n, size_t s) {
#define HEAP_FREE(p) dlfree(p)
static inline void HEAP_INIT(void) {}
void dump_callback(void *start, void *end, size_t used_bytes, void *arg) {
printf("\t\tstart %p end %p used_bytes %zu\n", start, end, used_bytes);
}
static inline void HEAP_DUMP(void) {
struct mallinfo minfo = dlmallinfo();
@@ -102,9 +106,6 @@ static inline void HEAP_DUMP(void) {
printf("\t\treleasable space 0x%zx\n", minfo.keepcost);
printf("\theap block list:\n");
void dump_callback(void *start, void *end, size_t used_bytes, void *arg) {
printf("\t\tstart %p end %p used_bytes %zu\n", start, end, used_bytes);
}
dlmalloc_inspect_all(&dump_callback, NULL);
}