From 1e879dc4325344fe9a454df14ad7b93cc14dbb6a Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 29 May 2025 17:58:25 +0200 Subject: [PATCH 1/6] let Z_CheckHeap print file and line of where it occured like its supposed to lel --- src/z_zone.c | 22 +++++++++++----------- src/z_zone.h | 8 +++++--- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/z_zone.c b/src/z_zone.c index 548c1e025..f1d1114e3 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -394,11 +394,11 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb * \param lowtag The lowest tag to consider. * \param hightag The highest tag to consider. */ -void Z_FreeTags(INT32 lowtag, INT32 hightag) +void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line) { memblock_t *block, *next; - Z_CheckHeap(420); + Z_CheckHeap2(file, line); for (block = head.next; block != &head; block = next) { next = block->next; // get link before freeing @@ -468,7 +468,7 @@ void Z_CheckMemCleanup(void) * \param i Identifies from where in the code Z_CheckHeap was called. * \author Graue */ -void Z_CheckHeap(INT32 i) +void Z_CheckHeap2(const char *file, INT32 line) { memblock_t *block; UINT32 blocknumon = 0; @@ -498,11 +498,11 @@ void Z_CheckHeap(INT32 i) #endif if (block->user != NULL && *(block->user) != given) { - I_Error("Z_CheckHeap %d: block %u" + I_Error("Z_CheckHeap %s %d: block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " doesn't have a proper user", i, blocknumon + " doesn't have a proper user", file, line, blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif @@ -510,11 +510,11 @@ void Z_CheckHeap(INT32 i) } if (block->next->prev != block) { - I_Error("Z_CheckHeap %d: block %u" + I_Error("Z_CheckHeap %s %d: block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " lacks proper backlink", i, blocknumon + " lacks proper backlink", file, line, blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif @@ -522,11 +522,11 @@ void Z_CheckHeap(INT32 i) } if (block->prev->next != block) { - I_Error("Z_CheckHeap %d: block %u" + I_Error("Z_CheckHeap %s %d: block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " lacks proper forward link", i, blocknumon + " lacks proper forward link", file, line, blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif @@ -534,11 +534,11 @@ void Z_CheckHeap(INT32 i) } if (block->id != ZONEID) { - I_Error("Z_CheckHeap %d: block %u" + I_Error("Z_CheckHeap %s %d: block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " have the wrong ID", i, blocknumon + " have the wrong ID", file, line, blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif diff --git a/src/z_zone.h b/src/z_zone.h index ab908bfec..2d0888e36 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -114,8 +114,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb // Free all memory by tag // these don't give line numbers for ZDEBUG currently though // (perhaps this should be changed in future?) -#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum) -void Z_FreeTags(INT32 lowtag, INT32 hightag); +#define Z_FreeTag(tagnum) Z_FreeTags2(tagnum, tagnum, __FILE__, __LINE__) +#define Z_FreeTags(tagnum, tagnum2) Z_FreeTags2(tagnum, tagnum2, __FILE__, __LINE__) +void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line); // Iterate memory by tag #define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func) @@ -125,7 +126,8 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *)); // Utility functions // void Z_CheckMemCleanup(void); -void Z_CheckHeap(INT32 i); +#define Z_CheckHeap(tag) Z_CheckHeap2(__FILE__, __LINE__) +void Z_CheckHeap2(const char *file, INT32 line); // // Zone memory modification From 4a4b5661f2e6f808e46147c4fb7db4048244acd5 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 22 Jul 2025 17:24:43 +0200 Subject: [PATCH 2/6] move this stuff behind ZDEBUG --- src/z_zone.c | 64 +++++++++++++++++++++++++++++++++++++++++++++------- src/z_zone.h | 10 ++++++++ 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/src/z_zone.c b/src/z_zone.c index f1d1114e3..ad756ceaa 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -394,11 +394,19 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb * \param lowtag The lowest tag to consider. * \param hightag The highest tag to consider. */ +#ifdef ZDEBUG void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line) +#else +void Z_FreeTags(INT32 lowtag, INT32 hightag) +#endif { memblock_t *block, *next; +#ifdef ZDEBUG Z_CheckHeap2(file, line); +#else + Z_CheckHeap(420); +#endif for (block = head.next; block != &head; block = next) { next = block->next; // get link before freeing @@ -468,12 +476,20 @@ void Z_CheckMemCleanup(void) * \param i Identifies from where in the code Z_CheckHeap was called. * \author Graue */ +#ifdef ZDEBUG void Z_CheckHeap2(const char *file, INT32 line) +#else +void Z_CheckHeap(INT32 tag) +#endif { memblock_t *block; UINT32 blocknumon = 0; void *given; +#ifndef ZDEBUG + (void)tag; +#endif + for (block = head.next; block != &head; block = block->next) { blocknumon++; @@ -498,11 +514,19 @@ void Z_CheckHeap2(const char *file, INT32 line) #endif if (block->user != NULL && *(block->user) != given) { - I_Error("Z_CheckHeap %s %d: block %u" + I_Error("Z_CheckHeap" +#ifdef ZDEBUG + "at %s %d :" +#endif + "block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " doesn't have a proper user", file, line, blocknumon + " doesn't have a proper user" +#ifdef ZDEBUG + , file, line +#endif + , blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif @@ -510,11 +534,19 @@ void Z_CheckHeap2(const char *file, INT32 line) } if (block->next->prev != block) { - I_Error("Z_CheckHeap %s %d: block %u" + I_Error("Z_CheckHeap" +#ifdef ZDEBUG + "at %s %d :" +#endif + "block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " lacks proper backlink", file, line, blocknumon + " lacks proper backlink" +#ifdef ZDEBUG + , file, line +#endif + , blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif @@ -522,11 +554,19 @@ void Z_CheckHeap2(const char *file, INT32 line) } if (block->prev->next != block) { - I_Error("Z_CheckHeap %s %d: block %u" + I_Error("Z_CheckHeap" +#ifdef ZDEBUG + "at %s %d :" +#endif + "block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " lacks proper forward link", file, line, blocknumon + " lacks proper forward link" +#ifdef ZDEBUG + , file, line +#endif + , blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif @@ -534,11 +574,19 @@ void Z_CheckHeap2(const char *file, INT32 line) } if (block->id != ZONEID) { - I_Error("Z_CheckHeap %s %d: block %u" + I_Error("Z_CheckHeap" +#ifdef ZDEBUG + "at %s %d :" +#endif + "block %u" #ifdef ZDEBUG "(owned by %s:%d)" #endif - " have the wrong ID", file, line, blocknumon + " have the wrong ID" +#ifdef ZDEBUG + , file, line +#endif + , blocknumon #ifdef ZDEBUG , block->ownerfile, block->ownerline #endif diff --git a/src/z_zone.h b/src/z_zone.h index 2d0888e36..ba85f5746 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -114,9 +114,14 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb // Free all memory by tag // these don't give line numbers for ZDEBUG currently though // (perhaps this should be changed in future?) +#ifdef ZDEBUG #define Z_FreeTag(tagnum) Z_FreeTags2(tagnum, tagnum, __FILE__, __LINE__) #define Z_FreeTags(tagnum, tagnum2) Z_FreeTags2(tagnum, tagnum2, __FILE__, __LINE__) void Z_FreeTags2(INT32 lowtag, INT32 hightag, const char *file, INT32 line); +#else +#define Z_FreeTag(tagnum) Z_FreeTags(tagnum, tagnum) +void Z_FreeTags(INT32 lowtag, INT32 hightag); +#endif // Iterate memory by tag #define Z_IterateTag(tagnum, func) Z_IterateTags(tagnum, tagnum, func) @@ -126,8 +131,13 @@ void Z_IterateTags(INT32 lowtag, INT32 hightag, boolean (*iterfunc)(void *)); // Utility functions // void Z_CheckMemCleanup(void); + +#ifdef ZDEBUG #define Z_CheckHeap(tag) Z_CheckHeap2(__FILE__, __LINE__) void Z_CheckHeap2(const char *file, INT32 line); +#else +void Z_CheckHeap(INT32 tag); +#endif // // Zone memory modification From 38576082fba1080a255aac43ea1f8bb15587a7b2 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 22 Jul 2025 17:31:44 +0200 Subject: [PATCH 3/6] move prints to ZDEBUG2 as it seems to be for this purpose --- src/z_zone.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/z_zone.c b/src/z_zone.c index ad756ceaa..bd97707c7 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -149,9 +149,12 @@ void Z_Free(void *ptr) #endif #endif -#ifdef ZDEBUG +#ifdef ZDEBUG2 // Write every Z_Free call to a debug file. CONS_Debug(DBG_MEMORY, "Z_Free at %s:%d\n", file, line); +#elif defined(ZDEBUG) + (void)file; + (void)line; #endif // anything that isn't by lua gets passed to lua just in case. @@ -358,8 +361,10 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb return NULL; #ifdef ZDEBUG +#ifdef ZDEBUG2 // Write every Z_Realloc call to a debug file. DEBFILE(va("Z_Realloc at %s:%d\n", file, line)); +#endif rez = Z_Malloc2(size, tag, user, alignbits, file, line); #else rez = Z_MallocAlign(size, tag, user, alignbits); From 7f3f332821e1a3df9260e90219dbbc49a3adf920 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 22 Jul 2025 17:33:07 +0200 Subject: [PATCH 4/6] Remove aligned allocation functions --- src/i_tcp.c | 8 +- src/r_data.c | 301 +++++++++++++++++++++++++++++++++++++++++++++++-- src/r_draw.cpp | 6 +- src/w_wad.c | 2 +- src/z_zone.c | 49 ++++---- src/z_zone.h | 23 ++-- 6 files changed, 327 insertions(+), 62 deletions(-) diff --git a/src/i_tcp.c b/src/i_tcp.c index 8151abce0..34b96b899 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1475,13 +1475,7 @@ static void AddBannedIndex(void) banned_size *= 2; } - banned = Z_ReallocAlign( - (void*) banned, - sizeof(banned_t) * banned_size, - PU_STATIC, - NULL, - sizeof(banned_t) * 8 - ); + banned = Z_Realloc((void*) banned, sizeof(banned_t) * banned_size, PU_STATIC, NULL); } numbans++; diff --git a/src/r_data.c b/src/r_data.c index f3731c3fc..f25173240 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1245,6 +1245,94 @@ static void R_InitSpriteLumps(void) Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo); } +// +// R_CreateFadeColormaps +// + +static void R_CreateFadeColormaps(void) +{ + UINT8 px, fade; + RGBA_t rgba; + INT32 r, g, b; + size_t len, i; + + len = (256 * FADECOLORMAPROWS); + fadecolormap = Z_Malloc(len*2, PU_STATIC, NULL); + for (i = 0; i < len*2; i++) + fadecolormap[i] = (i%256); + + // Load in the light tables, now 64k aligned for smokie... + { + lumpnum_t lump = W_CheckNumForName("FADECMAP"); + lumpnum_t wlump = W_CheckNumForName("FADEWMAP"); + + // to black + if (lump != LUMPERROR) + W_ReadLumpHeader(lump, fadecolormap, len, 0U); + // to white + if (wlump != LUMPERROR) + W_ReadLumpHeader(wlump, fadecolormap+len, len, 0U); + + // missing "to white" colormap lump + if (lump != LUMPERROR && wlump == LUMPERROR) + goto makewhite; + // missing "to black" colormap lump + else if (lump == LUMPERROR && wlump != LUMPERROR) + goto makeblack; + // both lumps found + else if (lump != LUMPERROR && wlump != LUMPERROR) + return; + } + +#define GETCOLOR \ + px = colormaps[i%256]; \ + fade = (i/256) * (256 / FADECOLORMAPROWS); \ + rgba = V_GetMasterColor(px); + + // to black + makeblack: + for (i = 0; i < len; i++) + { + // find pixel and fade amount + GETCOLOR; + + // subtractive color blending + r = rgba.s.red - FADEREDFACTOR*fade/10; + g = rgba.s.green - FADEGREENFACTOR*fade/10; + b = rgba.s.blue - FADEBLUEFACTOR*fade/10; + + // clamp values + if (r < 0) r = 0; + if (g < 0) g = 0; + if (b < 0) b = 0; + + // find nearest color in palette + fadecolormap[i] = NearestColor(r,g,b); + } + + // to white + makewhite: + for (i = len; i < len*2; i++) + { + // find pixel and fade amount + GETCOLOR; + + // additive color blending + r = rgba.s.red + FADEREDFACTOR*fade/10; + g = rgba.s.green + FADEGREENFACTOR*fade/10; + b = rgba.s.blue + FADEBLUEFACTOR*fade/10; + + // clamp values + if (r > 255) r = 255; + if (g > 255) g = 255; + if (b > 255) b = 255; + + // find nearest color in palette + fadecolormap[i] = NearestColor(r,g,b); + } +#undef GETCOLOR +} + // // R_InitColormaps // @@ -1254,8 +1342,7 @@ static void R_InitColormaps(void) // Load in the light tables lump = W_GetNumForName("COLORMAP"); - //Z_MallocAlign(W_LumpLength (lump), PU_STATIC, NULL, 8); - colormaps = Z_MallocAlign((256 * 64), PU_STATIC, NULL, 8); + colormaps = Z_Malloc((256 * 64), PU_STATIC, NULL); W_ReadLump(lump, colormaps); // no need to init encoremap at this stage @@ -1296,7 +1383,7 @@ void R_ReInitColormaps(UINT16 num, lumpnum_t newencoremap) lighttable_t *colormap_p, *colormap_p2; size_t p, i; - encoremap = Z_MallocAlign(256 + 10, PU_LEVEL, NULL, 8); + encoremap = Z_Malloc(256 + 10, PU_LEVEL, NULL); W_ReadLump(newencoremap, encoremap); colormap_p = colormap_p2 = colormaps; colormap_p += (256 * 32); @@ -1337,12 +1424,207 @@ void R_ClearColormaps(void) memset(extra_colormaps, 0, sizeof (extra_colormaps)); } -/*INT32 R_ColormapNumForName(char *name) +// +// R_GetDefaultColormap() +// +extracolormap_t *R_GetDefaultColormap(void) { - lumpnum_t lump, i; +#ifdef COLORMAPREVERSELIST + extracolormap_t *exc; +#endif - if (num_extra_colormaps == MAXCOLORMAPS) - I_Error("R_ColormapNumForName: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); + if (!extra_colormaps) + return (extra_colormaps = R_CreateDefaultColormap(true)); + +#ifdef COLORMAPREVERSELIST + for (exc = extra_colormaps; exc->next; exc = exc->next); + return exc; +#else + return extra_colormaps; +#endif +} + +// +// R_CopyColormap() +// NOTE: The result colormap is not added to the extra_colormaps chain. You must do that yourself! +// +extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable) +{ + extracolormap_t *exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL); + + if (!extra_colormap) + extra_colormap = R_GetDefaultColormap(); + + *exc = *extra_colormap; + exc->next = exc->prev = NULL; + +#ifdef EXTRACOLORMAPLUMPS + strncpy(exc->lumpname, extra_colormap->lumpname, 9); + + if (exc->lump != LUMPERROR && lighttable) + { + // aligned on 8 bit for asm code + exc->colormap = Z_Malloc(W_LumpLength(lump), PU_LEVEL, NULL); + W_ReadLump(lump, exc->colormap); + } + else +#endif + if (lighttable) + exc->colormap = R_CreateLightTable(exc); + else + exc->colormap = NULL; + + return exc; +} + +// +// R_AddColormapToList +// +// Sets prev/next chain for extra_colormaps var +// Copypasta from P_AddFFloorToList +// +void R_AddColormapToList(extracolormap_t *extra_colormap) +{ +#ifndef COLORMAPREVERSELIST + extracolormap_t *exc; +#endif + + if (!extra_colormaps) + { + extra_colormaps = extra_colormap; + extra_colormap->next = 0; + extra_colormap->prev = 0; + return; + } + +#ifdef COLORMAPREVERSELIST + extra_colormaps->prev = extra_colormap; + extra_colormap->next = extra_colormaps; + extra_colormaps = extra_colormap; + extra_colormap->prev = 0; +#else + for (exc = extra_colormaps; exc->next; exc = exc->next); + + exc->next = extra_colormap; + extra_colormap->prev = exc; + extra_colormap->next = 0; +#endif +} + +// +// R_CheckDefaultColormapByValues() +// +#ifdef EXTRACOLORMAPLUMPS +boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump) +#else +boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, + INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags) +#endif +{ + return ( + (!checkparams ? true : + (fadestart == 0 + && fadeend == 31 + && !flags) + ) + && (!checkrgba ? true : rgba == 0) + && (!checkfadergba ? true : (unsigned)fadergba == 0xFF000000) +#ifdef EXTRACOLORMAPLUMPS + && lump == LUMPERROR + && extra_colormap->lumpname[0] == 0 +#endif + ); +} + +boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams) +{ + if (!extra_colormap) + return true; + +#ifdef EXTRACOLORMAPLUMPS + return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags, extra_colormap->lump); +#else + return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags); +#endif +} + +boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams) +{ + // Treat NULL as default colormap + // We need this because what if one exc is a default colormap, and the other is NULL? They're really both equal. + if (!exc_a) + exc_a = R_GetDefaultColormap(); + if (!exc_b) + exc_b = R_GetDefaultColormap(); + + if (exc_a == exc_b) + return true; + + return ( + (!checkparams ? true : + (exc_a->fadestart == exc_b->fadestart + && exc_a->fadeend == exc_b->fadeend + && exc_a->flags == exc_b->flags) + ) + && (!checkrgba ? true : exc_a->rgba == exc_b->rgba) + && (!checkfadergba ? true : exc_a->fadergba == exc_b->fadergba) +#ifdef EXTRACOLORMAPLUMPS + && exc_a->lump == exc_b->lump + && !strncmp(exc_a->lumpname, exc_b->lumpname, 9) +#endif + ); +} + +// +// R_GetColormapFromListByValues() +// NOTE: Returns NULL if no match is found +// +#ifdef EXTRACOLORMAPLUMPS +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump) +#else +extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags) +#endif +{ + extracolormap_t *exc; + UINT32 dbg_i = 0; + + for (exc = extra_colormaps; exc; exc = exc->next) + { + if (rgba == exc->rgba + && fadergba == exc->fadergba + && fadestart == exc->fadestart + && fadeend == exc->fadeend + && flags == exc->flags +#ifdef EXTRACOLORMAPLUMPS + && (lump != LUMPERROR && lump == exc->lump) +#endif + ) + { + CONS_Debug(DBG_RENDER, "Found Colormap %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n", + dbg_i, R_GetRgbaR(rgba), R_GetRgbaG(rgba), R_GetRgbaB(rgba), R_GetRgbaA(rgba), + R_GetRgbaR(fadergba), R_GetRgbaG(fadergba), R_GetRgbaB(fadergba), R_GetRgbaA(fadergba)); + return exc; + } + dbg_i++; + } + return NULL; +} + +extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap) +{ +#ifdef EXTRACOLORMAPLUMPS + return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags, extra_colormap->lump); +#else + return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags); +#endif +} + +#ifdef EXTRACOLORMAPLUMPS +extracolormap_t *R_ColormapForName(char *name) +{ + lumpnum_t lump; + extracolormap_t *exc; lump = R_CheckNumForNameList(name, colormaplumps, numcolormaplumps); if (lump == LUMPERROR) @@ -1354,8 +1636,7 @@ void R_ClearColormaps(void) foundcolormaps[num_extra_colormaps] = lump; - // aligned on 8 bit for asm code - extra_colormaps[num_extra_colormaps].colormap = Z_MallocAlign(W_LumpLength(lump), PU_LEVEL, NULL, 16); + extra_colormaps[num_extra_colormaps].colormap = Z_Malloc(W_LumpLength(lump), PU_LEVEL, NULL); W_ReadLump(lump, extra_colormaps[num_extra_colormaps].colormap); // We set all params of the colormap to normal because there @@ -1551,7 +1832,7 @@ INT32 R_CreateColormap(char *p1, char *p2, char *p3) } // Now allocate memory for the actual colormap array itself! - colormap_p = Z_MallocAlign((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL, 8); + colormap_p = Z_Malloc((256 * (encoremap ? 64 : 32)) + 10, PU_LEVEL, NULL); extra_colormaps[mapnum].colormap = (UINT8 *)colormap_p; // Calculate the palette index for each palette index, for each light level diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 23d512a19..e399fab0e 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -119,7 +119,7 @@ void R_InitTranslucencyTables(void) // Load here the transparency lookup tables 'TRANSx0' // NOTE: the TRANSx0 resources MUST BE aligned on 64k for the asm // optimised code (in other words, transtables pointer low word is 0) - transtables = static_cast(Z_MallocAlign(NUMTRANSTABLES*0x10000, PU_STATIC, NULL, 16)); + transtables = static_cast(Z_Malloc(NUMTRANSTABLES*0x10000, PU_STATIC, NULL)); W_ReadLump(W_GetNumForName("TRANS10"), transtables); W_ReadLump(W_GetNumForName("TRANS20"), transtables+0x10000); @@ -246,7 +246,7 @@ static void R_GenerateBlendTables(void) INT32 i; for (i = 0; i < NUMBLENDMAPS; i++) - blendtables[i] = static_cast(Z_MallocAlign(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL, 16)); + blendtables[i] = static_cast(Z_Malloc(BlendTab_Count[i] * 0x10000, PU_STATIC, NULL)); InitColorLUT(&transtab_lut, pLocalPalette, false); @@ -365,7 +365,7 @@ static UINT8* RGetTranslationColormap(INT32 skinnum, skincolors_t color, UINT8 f // Generate the colormap if necessary if (!ret) { - ret = static_cast(Z_MallocAlign(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL, 8)); + ret = static_cast(Z_Malloc(NUM_PALETTE_ENTRIES, (flags & GTC_CACHE) ? PU_LEVEL : PU_STATIC, NULL)); K_GenerateKartColormap(ret, skinnum, color, local); //R_GenerateTranslationColormap(ret, skinnum, color); // SRB2kart // Cache the colormap if desired diff --git a/src/w_wad.c b/src/w_wad.c index 6490f561d..63071ea3b 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -611,7 +611,7 @@ static lumpinfo_t* ResGetLumpsZip (FILE* handle, UINT16* nlmp) fseek(handle, LONG(zend.cdiroffset), SEEK_SET); - char *cdir = (Z_MallocAlign(LONG(zend.cdirsize), PU_STATIC, &cdir, 7)); + char *cdir = Z_Malloc(LONG(zend.cdirsize), PU_STATIC, &cdir); if (fread(cdir, 1, LONG(zend.cdirsize), handle) < (UINT32)(LONG(zend.cdirsize))) { diff --git a/src/z_zone.c b/src/z_zone.c index bd97707c7..8647f91fa 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -205,7 +205,7 @@ static void *xm(size_t size) return p; } -/** The Z_MallocAlign function. +/** The Z_Malloc function. * Allocates a block of memory, adds it to a linked list so we can keep track of it. * * \param size Amount of memory to be allocated, in bytes. @@ -213,22 +213,19 @@ static void *xm(size_t size) * \param user The address of a pointer to the memory to be allocated. * When the memory is freed by Z_Free later, * the pointer at this address will then be automatically set to NULL. - * \param alignbits The alignment of the memory to be allocated, in bits. Can be 0. * \note You can pass Z_Malloc() a NULL user if the tag is less than PU_PURGELEVEL. - * \sa Z_CallocAlign, Z_ReallocAlign + * \sa Z_Calloc, Z_Realloc */ #ifdef ZDEBUG -void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, +void *Z_Malloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) #else -void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) +void *Z_Malloc(size_t size, INT32 tag, void *user) #endif { memblock_t *block; void *ptr; - (void)(alignbits); // no longer used, so silence warnings. TODO we should figure out a solution for this - #ifdef ZDEBUG2 CONS_Debug(DBG_MEMORY, "Z_Malloc %s:%d\n", file, line); #endif @@ -273,55 +270,53 @@ void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) return ptr; } -/** The Z_CallocAlign function. +/** The Z_Calloc function. * Allocates a block of memory, adds it to a linked list so we can keep track of it. - * Unlike Z_MallocAlign, this also initialises the bytes to zero. + * Unlike Z_Malloc, this also initialises the bytes to zero. * * \param size Amount of memory to be allocated, in bytes. * \param tag Purge tag. * \param user The address of a pointer to the memory to be allocated. * When the memory is freed by Z_Free later, * the pointer at this address will then be automatically set to NULL. - * \param alignbits The alignment of the memory to be allocated, in bits. Can be 0. * \note You can pass Z_Calloc() a NULL user if the tag is less than PU_PURGELEVEL. - * \sa Z_MallocAlign, Z_ReallocAlign + * \sa Z_Malloc, Z_Realloc */ #ifdef ZDEBUG -void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) +void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) #else -void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) +void *Z_Calloc(size_t size, INT32 tag, void *user) #endif { #ifdef VALGRIND_MEMPOOL_ALLOC Z_calloc = true; #endif #ifdef ZDEBUG - return memset(Z_Malloc2 (size, tag, user, alignbits, file, line), 0, size); + return memset(Z_Malloc2(size, tag, user, file, line), 0, size); #else - return memset(Z_MallocAlign(size, tag, user, alignbits ), 0, size); + return memset(Z_Malloc (size, tag, user ), 0, size); #endif } -/** The Z_ReallocAlign function. +/** The Z_Realloc function. * Reallocates a block of memory with a new size. * * \param ptr A pointer to allocated memory, * assumed to have been allocated with Z_Malloc/Z_Calloc. - * If NULL, this function instead acts as a wrapper for Z_CallocAlign. + * If NULL, this function instead acts as a wrapper for Z_Calloc. * \param size New size of memory block, in bytes. * If zero, then the memory is freed and NULL is returned. * \param tag New purge tag. * \param user The address of a pointer to the memory to be reallocated. * This can be a different user to the one originally assigned to the memory block. - * \param alignbits The alignment of the memory to be allocated, in bits. Can be 0. * \return A pointer to the reallocated memory. Can be NULL if memory was freed. * \note You can pass Z_Realloc() a NULL user if the tag is less than PU_PURGELEVEL. - * \sa Z_MallocAlign, Z_CallocAlign + * \sa Z_Malloc, Z_Calloc */ #ifdef ZDEBUG -void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) +void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, const char *file, INT32 line) #else -void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) +void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user) #endif { void *rez; @@ -341,9 +336,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb if (!ptr) { #ifdef ZDEBUG - return Z_Calloc2(size, tag, user, alignbits, file , line); + return Z_Calloc2(size, tag, user, file, line); #else - return Z_CallocAlign(size, tag, user, alignbits); + return Z_Calloc(size, tag, user); #endif } @@ -351,9 +346,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb #ifdef PARANOIA if (block->id != ZONEID) #ifdef ZDEBUG - I_Error("Z_ReallocAlign at %s:%d: wrong id", file, line); + I_Error("Z_Realloc at %s:%d: wrong id", file, line); #else - I_Error("Z_ReallocAlign: wrong id"); + I_Error("Z_Realloc: wrong id"); #endif #endif @@ -365,9 +360,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb // Write every Z_Realloc call to a debug file. DEBFILE(va("Z_Realloc at %s:%d\n", file, line)); #endif - rez = Z_Malloc2(size, tag, user, alignbits, file, line); + rez = Z_Malloc2(size, tag, user, file, line); #else - rez = Z_MallocAlign(size, tag, user, alignbits); + rez = Z_Malloc(size, tag, user); #endif if (size < block->realsize) diff --git a/src/z_zone.h b/src/z_zone.h index ba85f5746..0599ef3f6 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -92,25 +92,20 @@ void Z_Init(void); // Z_Free and alloc with alignment #ifdef ZDEBUG #define Z_Free(p) Z_Free2(p, __FILE__, __LINE__) -#define Z_MallocAlign(s,t,u,a) Z_Malloc2(s, t, u, a, __FILE__, __LINE__) -#define Z_CallocAlign(s,t,u,a) Z_Calloc2(s, t, u, a, __FILE__, __LINE__) -#define Z_ReallocAlign(p,s,t,u,a) Z_Realloc2(p,s, t, u, a, __FILE__, __LINE__) +#define Z_Malloc(s,t,u) Z_Malloc2(s, t, u, __FILE__, __LINE__) +#define Z_Calloc(s,t,u) Z_Calloc2(s, t, u, __FILE__, __LINE__) +#define Z_Realloc(p,s,t,u) Z_Realloc2(p,s, t, u, __FILE__, __LINE__) void Z_Free2(void *ptr, const char *file, INT32 line); -void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1); -void *Z_Calloc2(size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(1); -void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits, const char *file, INT32 line) FUNCALLOC(2); +void *Z_Malloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(1); +void *Z_Calloc2(size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(1); +void *Z_Realloc2(void *ptr, size_t size, INT32 tag, void *user, const char *file, INT32 line) FUNCALLOC(2); #else void Z_Free(void *ptr); -void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1); -void *Z_CallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(1); -void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignbits) FUNCALLOC(2); +void *Z_Malloc(size_t size, INT32 tag, void *user) FUNCALLOC(1); +void *Z_Calloc(size_t size, INT32 tag, void *user) FUNCALLOC(1); +void *Z_Realloc(void *ptr, size_t size, INT32 tag, void *user) FUNCALLOC(2); #endif -// Alloc with standard alignment -#define Z_Malloc(s,t,u) Z_MallocAlign(s, t, u, sizeof(void *)) -#define Z_Calloc(s,t,u) Z_CallocAlign(s, t, u, sizeof(void *)) -#define Z_Realloc(p,s,t,u) Z_ReallocAlign(p, s, t, u, sizeof(void *)) - // Free all memory by tag // these don't give line numbers for ZDEBUG currently though // (perhaps this should be changed in future?) From 3c78c5c57dfd5f18f19607c6e6f147cc7ec3fa0e Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 19 Jun 2025 16:26:18 +0200 Subject: [PATCH 5/6] ok git very cool --- src/r_data.c | 292 +-------------------------------------------------- 1 file changed, 5 insertions(+), 287 deletions(-) diff --git a/src/r_data.c b/src/r_data.c index f25173240..689c6541a 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1245,94 +1245,6 @@ static void R_InitSpriteLumps(void) Z_Malloc(max_spritelumps*sizeof(*spritecachedinfo), PU_STATIC, &spritecachedinfo); } -// -// R_CreateFadeColormaps -// - -static void R_CreateFadeColormaps(void) -{ - UINT8 px, fade; - RGBA_t rgba; - INT32 r, g, b; - size_t len, i; - - len = (256 * FADECOLORMAPROWS); - fadecolormap = Z_Malloc(len*2, PU_STATIC, NULL); - for (i = 0; i < len*2; i++) - fadecolormap[i] = (i%256); - - // Load in the light tables, now 64k aligned for smokie... - { - lumpnum_t lump = W_CheckNumForName("FADECMAP"); - lumpnum_t wlump = W_CheckNumForName("FADEWMAP"); - - // to black - if (lump != LUMPERROR) - W_ReadLumpHeader(lump, fadecolormap, len, 0U); - // to white - if (wlump != LUMPERROR) - W_ReadLumpHeader(wlump, fadecolormap+len, len, 0U); - - // missing "to white" colormap lump - if (lump != LUMPERROR && wlump == LUMPERROR) - goto makewhite; - // missing "to black" colormap lump - else if (lump == LUMPERROR && wlump != LUMPERROR) - goto makeblack; - // both lumps found - else if (lump != LUMPERROR && wlump != LUMPERROR) - return; - } - -#define GETCOLOR \ - px = colormaps[i%256]; \ - fade = (i/256) * (256 / FADECOLORMAPROWS); \ - rgba = V_GetMasterColor(px); - - // to black - makeblack: - for (i = 0; i < len; i++) - { - // find pixel and fade amount - GETCOLOR; - - // subtractive color blending - r = rgba.s.red - FADEREDFACTOR*fade/10; - g = rgba.s.green - FADEGREENFACTOR*fade/10; - b = rgba.s.blue - FADEBLUEFACTOR*fade/10; - - // clamp values - if (r < 0) r = 0; - if (g < 0) g = 0; - if (b < 0) b = 0; - - // find nearest color in palette - fadecolormap[i] = NearestColor(r,g,b); - } - - // to white - makewhite: - for (i = len; i < len*2; i++) - { - // find pixel and fade amount - GETCOLOR; - - // additive color blending - r = rgba.s.red + FADEREDFACTOR*fade/10; - g = rgba.s.green + FADEGREENFACTOR*fade/10; - b = rgba.s.blue + FADEBLUEFACTOR*fade/10; - - // clamp values - if (r > 255) r = 255; - if (g > 255) g = 255; - if (b > 255) b = 255; - - // find nearest color in palette - fadecolormap[i] = NearestColor(r,g,b); - } -#undef GETCOLOR -} - // // R_InitColormaps // @@ -1424,207 +1336,12 @@ void R_ClearColormaps(void) memset(extra_colormaps, 0, sizeof (extra_colormaps)); } -// -// R_GetDefaultColormap() -// -extracolormap_t *R_GetDefaultColormap(void) +/*INT32 R_ColormapNumForName(char *name) { -#ifdef COLORMAPREVERSELIST - extracolormap_t *exc; -#endif + lumpnum_t lump, i; - if (!extra_colormaps) - return (extra_colormaps = R_CreateDefaultColormap(true)); - -#ifdef COLORMAPREVERSELIST - for (exc = extra_colormaps; exc->next; exc = exc->next); - return exc; -#else - return extra_colormaps; -#endif -} - -// -// R_CopyColormap() -// NOTE: The result colormap is not added to the extra_colormaps chain. You must do that yourself! -// -extracolormap_t *R_CopyColormap(extracolormap_t *extra_colormap, boolean lighttable) -{ - extracolormap_t *exc = Z_Calloc(sizeof (*exc), PU_LEVEL, NULL); - - if (!extra_colormap) - extra_colormap = R_GetDefaultColormap(); - - *exc = *extra_colormap; - exc->next = exc->prev = NULL; - -#ifdef EXTRACOLORMAPLUMPS - strncpy(exc->lumpname, extra_colormap->lumpname, 9); - - if (exc->lump != LUMPERROR && lighttable) - { - // aligned on 8 bit for asm code - exc->colormap = Z_Malloc(W_LumpLength(lump), PU_LEVEL, NULL); - W_ReadLump(lump, exc->colormap); - } - else -#endif - if (lighttable) - exc->colormap = R_CreateLightTable(exc); - else - exc->colormap = NULL; - - return exc; -} - -// -// R_AddColormapToList -// -// Sets prev/next chain for extra_colormaps var -// Copypasta from P_AddFFloorToList -// -void R_AddColormapToList(extracolormap_t *extra_colormap) -{ -#ifndef COLORMAPREVERSELIST - extracolormap_t *exc; -#endif - - if (!extra_colormaps) - { - extra_colormaps = extra_colormap; - extra_colormap->next = 0; - extra_colormap->prev = 0; - return; - } - -#ifdef COLORMAPREVERSELIST - extra_colormaps->prev = extra_colormap; - extra_colormap->next = extra_colormaps; - extra_colormaps = extra_colormap; - extra_colormap->prev = 0; -#else - for (exc = extra_colormaps; exc->next; exc = exc->next); - - exc->next = extra_colormap; - extra_colormap->prev = exc; - extra_colormap->next = 0; -#endif -} - -// -// R_CheckDefaultColormapByValues() -// -#ifdef EXTRACOLORMAPLUMPS -boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, - INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump) -#else -boolean R_CheckDefaultColormapByValues(boolean checkrgba, boolean checkfadergba, boolean checkparams, - INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags) -#endif -{ - return ( - (!checkparams ? true : - (fadestart == 0 - && fadeend == 31 - && !flags) - ) - && (!checkrgba ? true : rgba == 0) - && (!checkfadergba ? true : (unsigned)fadergba == 0xFF000000) -#ifdef EXTRACOLORMAPLUMPS - && lump == LUMPERROR - && extra_colormap->lumpname[0] == 0 -#endif - ); -} - -boolean R_CheckDefaultColormap(extracolormap_t *extra_colormap, boolean checkrgba, boolean checkfadergba, boolean checkparams) -{ - if (!extra_colormap) - return true; - -#ifdef EXTRACOLORMAPLUMPS - return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags, extra_colormap->lump); -#else - return R_CheckDefaultColormapByValues(checkrgba, checkfadergba, checkparams, extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags); -#endif -} - -boolean R_CheckEqualColormaps(extracolormap_t *exc_a, extracolormap_t *exc_b, boolean checkrgba, boolean checkfadergba, boolean checkparams) -{ - // Treat NULL as default colormap - // We need this because what if one exc is a default colormap, and the other is NULL? They're really both equal. - if (!exc_a) - exc_a = R_GetDefaultColormap(); - if (!exc_b) - exc_b = R_GetDefaultColormap(); - - if (exc_a == exc_b) - return true; - - return ( - (!checkparams ? true : - (exc_a->fadestart == exc_b->fadestart - && exc_a->fadeend == exc_b->fadeend - && exc_a->flags == exc_b->flags) - ) - && (!checkrgba ? true : exc_a->rgba == exc_b->rgba) - && (!checkfadergba ? true : exc_a->fadergba == exc_b->fadergba) -#ifdef EXTRACOLORMAPLUMPS - && exc_a->lump == exc_b->lump - && !strncmp(exc_a->lumpname, exc_b->lumpname, 9) -#endif - ); -} - -// -// R_GetColormapFromListByValues() -// NOTE: Returns NULL if no match is found -// -#ifdef EXTRACOLORMAPLUMPS -extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags, lumpnum_t lump) -#else -extracolormap_t *R_GetColormapFromListByValues(INT32 rgba, INT32 fadergba, UINT8 fadestart, UINT8 fadeend, UINT8 flags) -#endif -{ - extracolormap_t *exc; - UINT32 dbg_i = 0; - - for (exc = extra_colormaps; exc; exc = exc->next) - { - if (rgba == exc->rgba - && fadergba == exc->fadergba - && fadestart == exc->fadestart - && fadeend == exc->fadeend - && flags == exc->flags -#ifdef EXTRACOLORMAPLUMPS - && (lump != LUMPERROR && lump == exc->lump) -#endif - ) - { - CONS_Debug(DBG_RENDER, "Found Colormap %d: rgba(%d,%d,%d,%d) fadergba(%d,%d,%d,%d)\n", - dbg_i, R_GetRgbaR(rgba), R_GetRgbaG(rgba), R_GetRgbaB(rgba), R_GetRgbaA(rgba), - R_GetRgbaR(fadergba), R_GetRgbaG(fadergba), R_GetRgbaB(fadergba), R_GetRgbaA(fadergba)); - return exc; - } - dbg_i++; - } - return NULL; -} - -extracolormap_t *R_GetColormapFromList(extracolormap_t *extra_colormap) -{ -#ifdef EXTRACOLORMAPLUMPS - return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags, extra_colormap->lump); -#else - return R_GetColormapFromListByValues(extra_colormap->rgba, extra_colormap->fadergba, extra_colormap->fadestart, extra_colormap->fadeend, extra_colormap->flags); -#endif -} - -#ifdef EXTRACOLORMAPLUMPS -extracolormap_t *R_ColormapForName(char *name) -{ - lumpnum_t lump; - extracolormap_t *exc; + if (num_extra_colormaps == MAXCOLORMAPS) + I_Error("R_ColormapNumForName: Too many colormaps! the limit is %d\n", MAXCOLORMAPS); lump = R_CheckNumForNameList(name, colormaplumps, numcolormaplumps); if (lump == LUMPERROR) @@ -1636,6 +1353,7 @@ extracolormap_t *R_ColormapForName(char *name) foundcolormaps[num_extra_colormaps] = lump; + // aligned on 8 bit for asm code extra_colormaps[num_extra_colormaps].colormap = Z_Malloc(W_LumpLength(lump), PU_LEVEL, NULL); W_ReadLump(lump, extra_colormaps[num_extra_colormaps].colormap); From 29cf728fac931ade533b11f932146c1afe55ca78 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 22 Jul 2025 17:29:25 +0200 Subject: [PATCH 6/6] enable ZDEBUG by default this is just quite useful honestly --- src/z_zone.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/z_zone.h b/src/z_zone.h index 0599ef3f6..adbabb37e 100644 --- a/src/z_zone.h +++ b/src/z_zone.h @@ -32,7 +32,7 @@ extern "C" { #define FUNCALLOC(x) #endif -//#define ZDEBUG +#define ZDEBUG // // Purge tags