From 02ab7f37458c34b67bbb87b7650e73ab51c01a64 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 15 Nov 2022 12:57:07 -0800 Subject: [PATCH] Fixed release build using clang on Windows --- src/stdlib/SDL_malloc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/stdlib/SDL_malloc.c b/src/stdlib/SDL_malloc.c index 093a2a0e9..ebafb66cf 100644 --- a/src/stdlib/SDL_malloc.c +++ b/src/stdlib/SDL_malloc.c @@ -3463,7 +3463,9 @@ add_segment(mstate m, char *tbase, size_t tsize, flag_t mmapped) msegmentptr ss = (msegmentptr) (chunk2mem(sp)); mchunkptr tnext = chunk_plus_offset(sp, ssize); mchunkptr p = tnext; +#ifdef DEBUG int nfences = 0; +#endif /* reset top to new space */ init_top(m, (mchunkptr) tbase, tsize - TOP_FOOT_SIZE); @@ -3481,13 +3483,17 @@ add_segment(mstate m, char *tbase, size_t tsize, flag_t mmapped) for (;;) { mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); p->head = FENCEPOST_HEAD; +#ifdef DEBUG ++nfences; +#endif if ((char *) (&(nextp->head)) < old_end) p = nextp; else break; } +#ifdef DEBUG assert(nfences >= 2); +#endif /* Insert the rest of old top into a bin as an ordinary free chunk */ if (csp != old_top) {