- a few more explicit local buffer allocations removed.

This commit is contained in:
Christoph Oelckers 2018-12-21 10:26:09 +01:00
parent cf18dbdfa7
commit ebaabcfb4f
3 changed files with 11 additions and 20 deletions

View file

@ -532,8 +532,8 @@ void InitRenderInfo()
PrepareSegs();
PrepareSectorData();
InitVertexData();
int *checkmap = new int[level.vertexes.Size()];
memset(checkmap, -1, sizeof(int)*level.vertexes.Size());
TArray<int> checkmap(level.vertexes.Size());
memset(checkmap.Data(), -1, sizeof(int)*level.vertexes.Size());
for(auto &sec : level.sectors)
{
int i = sec.sectornum;
@ -562,11 +562,6 @@ void InitRenderInfo()
}
}
}
delete[] checkmap;
#if 0
gl_CreateSections();
#endif
}

View file

@ -315,12 +315,12 @@ void R_InitSpriteDefs ()
struct Hasher
{
int Head, Next;
} *hashes;
};
struct VHasher
{
int Head, Next, Name, Spin;
char Frame;
} *vhashes;
};
unsigned int i, j, smax, vmax;
uint32_t intname;
@ -328,8 +328,8 @@ void R_InitSpriteDefs ()
// Create a hash table to speed up the process
smax = TexMan.NumTextures();
hashes = new Hasher[smax];
memset(hashes, -1, sizeof(Hasher)*smax);
TArray<Hasher> hashes(smax, true);
memset(hashes.Data(), -1, sizeof(Hasher)*smax);
for (i = 0; i < smax; ++i)
{
FTexture *tex = TexMan.ByIndex(i);
@ -343,8 +343,8 @@ void R_InitSpriteDefs ()
// Repeat, for voxels
vmax = Wads.GetNumLumps();
vhashes = new VHasher[vmax];
memset(vhashes, -1, sizeof(VHasher)*vmax);
TArray<VHasher> vhashes(vmax, true);
memset(vhashes.Data(), -1, sizeof(VHasher)*vmax);
for (i = 0; i < vmax; ++i)
{
if (Wads.GetLumpNamespace(i) == ns_voxels)
@ -459,9 +459,6 @@ void R_InitSpriteDefs ()
R_InstallSprite ((int)i, sprtemp, maxframe);
}
delete[] hashes;
delete[] vhashes;
}
//==========================================================================

View file

@ -464,10 +464,9 @@ bool FSerializer::OpenReader(FCompressedBuffer *input)
}
else
{
char *unpacked = new char[input->mSize];
input->Decompress(unpacked);
r = new FReader(unpacked, input->mSize);
delete[] unpacked;
TArray<char> unpacked(input->mSize);
input->Decompress(unpacked.Data());
r = new FReader(unpacked.Data(), input->mSize);
}
return true;
}