- 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(); PrepareSegs();
PrepareSectorData(); PrepareSectorData();
InitVertexData(); InitVertexData();
int *checkmap = new int[level.vertexes.Size()]; TArray<int> checkmap(level.vertexes.Size());
memset(checkmap, -1, sizeof(int)*level.vertexes.Size()); memset(checkmap.Data(), -1, sizeof(int)*level.vertexes.Size());
for(auto &sec : level.sectors) for(auto &sec : level.sectors)
{ {
int i = sec.sectornum; 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 struct Hasher
{ {
int Head, Next; int Head, Next;
} *hashes; };
struct VHasher struct VHasher
{ {
int Head, Next, Name, Spin; int Head, Next, Name, Spin;
char Frame; char Frame;
} *vhashes; };
unsigned int i, j, smax, vmax; unsigned int i, j, smax, vmax;
uint32_t intname; uint32_t intname;
@ -328,8 +328,8 @@ void R_InitSpriteDefs ()
// Create a hash table to speed up the process // Create a hash table to speed up the process
smax = TexMan.NumTextures(); smax = TexMan.NumTextures();
hashes = new Hasher[smax]; TArray<Hasher> hashes(smax, true);
memset(hashes, -1, sizeof(Hasher)*smax); memset(hashes.Data(), -1, sizeof(Hasher)*smax);
for (i = 0; i < smax; ++i) for (i = 0; i < smax; ++i)
{ {
FTexture *tex = TexMan.ByIndex(i); FTexture *tex = TexMan.ByIndex(i);
@ -343,8 +343,8 @@ void R_InitSpriteDefs ()
// Repeat, for voxels // Repeat, for voxels
vmax = Wads.GetNumLumps(); vmax = Wads.GetNumLumps();
vhashes = new VHasher[vmax]; TArray<VHasher> vhashes(vmax, true);
memset(vhashes, -1, sizeof(VHasher)*vmax); memset(vhashes.Data(), -1, sizeof(VHasher)*vmax);
for (i = 0; i < vmax; ++i) for (i = 0; i < vmax; ++i)
{ {
if (Wads.GetLumpNamespace(i) == ns_voxels) if (Wads.GetLumpNamespace(i) == ns_voxels)
@ -459,9 +459,6 @@ void R_InitSpriteDefs ()
R_InstallSprite ((int)i, sprtemp, maxframe); R_InstallSprite ((int)i, sprtemp, maxframe);
} }
delete[] hashes;
delete[] vhashes;
} }
//========================================================================== //==========================================================================

View file

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