From 4169e7bd718363da78abdbe07487cfb340df605c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Mon, 16 Jun 2025 22:18:13 +0200 Subject: [PATCH] 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 37c08f6d5..299a4b5c1 100644 --- a/src/i_tcp.c +++ b/src/i_tcp.c @@ -1531,13 +1531,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 0bbc707db..23a308245 100644 --- a/src/r_data.c +++ b/src/r_data.c @@ -1299,6 +1299,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 // @@ -1308,8 +1396,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 @@ -1350,7 +1437,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); @@ -1391,12 +1478,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) @@ -1408,8 +1690,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 @@ -1605,7 +1886,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 bf9389986..4214eb8c2 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -634,7 +634,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 548c1e025..c25109d46 100644 --- a/src/z_zone.c +++ b/src/z_zone.c @@ -202,7 +202,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. @@ -210,22 +210,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 @@ -270,55 +267,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; @@ -338,9 +333,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 } @@ -348,9 +343,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 @@ -360,9 +355,9 @@ void *Z_ReallocAlign(void *ptr, size_t size, INT32 tag, void *user, INT32 alignb #ifdef ZDEBUG // Write every Z_Realloc call to a debug file. DEBFILE(va("Z_Realloc at %s:%d\n", file, line)); - 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 ab908bfec..b6daa920b 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?)