Get rid of DYNALLOC_ARRAYS

It's garbage and the "functionality" it provided is something that will be able to be achieved in a better way in a future commit.

git-svn-id: https://svn.eduke32.com/eduke32@7708 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2019-06-25 11:29:23 +00:00 committed by Christoph Oelckers
parent d2b3691e22
commit 29b626fc5d

View file

@ -7687,11 +7687,7 @@ int32_t engineFatalError(char const * const msg)
// //
static int32_t preinitcalled = 0; static int32_t preinitcalled = 0;
// #define DYNALLOC_ARRAYS #if !defined DEBUG_MAIN_ARRAYS
#ifdef DYNALLOC_ARRAYS
void *blockptr = NULL;
#elif !defined DEBUG_MAIN_ARRAYS
static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID]; static spriteext_t spriteext_s[MAXSPRITES+MAXUNIQHUDID];
static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID]; static spritesmooth_t spritesmooth_s[MAXSPRITES+MAXUNIQHUDID];
static sectortype sector_s[MAXSECTORS + M32_FIXME_SECTORS]; static sectortype sector_s[MAXSECTORS + M32_FIXME_SECTORS];
@ -7710,60 +7706,7 @@ int32_t enginePreInit(void)
if (initsystem()) Bexit(9); if (initsystem()) Bexit(9);
makeasmwriteable(); makeasmwriteable();
#ifdef DYNALLOC_ARRAYS #if !defined DEBUG_MAIN_ARRAYS
{
size_t i, size = 0;
// allocate everything at once... why not? entries can just be added to this table
// to allocate future arrays without further intervention
struct
{
void **ptr;
size_t size;
}
dynarray[] =
{
{ (void **) &sector, sizeof(sectortype) *MAXSECTORS },
{ (void **) &wall, sizeof(walltype) *MAXWALLS }, // +512: editor quirks. FIXME!
# ifndef NEW_MAP_FORMAT
{ (void **) &wallext, sizeof(wallext_t) *MAXWALLS },
# endif
{ (void **) &sprite, sizeof(spritetype) *MAXSPRITES },
{ (void **) &tsprite, sizeof(spritetype) *MAXSPRITESONSCREEN },
{ (void **) &spriteext, sizeof(spriteext_t) *(MAXSPRITES+MAXUNIQHUDID) },
{ (void **) &spritesmooth, sizeof(spritesmooth_t) *(MAXSPRITES+MAXUNIQHUDID) },
};
if (editstatus)
{
dynarray[0].size += M32_FIXME_SECTORS*sizeof(sectortype); // join sectors needs a temp. sector
dynarray[1].size += M32_FIXME_WALLS*sizeof(walltype);
// Bprintf("FIXME: Allocating additional space beyond wall[] for editor bugs.\n");
}
#if 0
for (i=0; i<(signed)ARRAY_SIZE(dynarray); i++)
size += dynarray[i].size;
blockptr = Xcalloc(1, size);
size = 0;
for (i=0; i<(signed)ARRAY_SIZE(dynarray); i++)
{
*dynarray[i].ptr = (int8_t *)blockptr + size;
size += dynarray[i].size;
}
#else
for (i = 0; i < (signed) ARRAY_SIZE(dynarray); i++)
{
Xaligned_free(*dynarray[i].ptr);
*dynarray[i].ptr = Xaligned_alloc(16, dynarray[i].size);
}
#endif
}
#elif !defined DEBUG_MAIN_ARRAYS
sector = sector_s; sector = sector_s;
wall = wall_s; wall = wall_s;
# ifndef NEW_MAP_FORMAT # ifndef NEW_MAP_FORMAT
@ -7929,9 +7872,6 @@ void engineUnInit(void)
Bmemset(basepaltable, 0, sizeof(basepaltable)); Bmemset(basepaltable, 0, sizeof(basepaltable));
basepaltable[0] = palette; basepaltable[0] = palette;
#ifdef DYNALLOC_ARRAYS
DO_FREE_AND_NULL(blockptr);
#endif
DO_FREE_AND_NULL(kpzbuf); DO_FREE_AND_NULL(kpzbuf);
kpzbufsiz = 0; kpzbufsiz = 0;