mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-11 15:22:16 +00:00
- two more places where explicit allocations could be replaced.
This commit is contained in:
parent
091f73b833
commit
39f6489ac5
2 changed files with 5 additions and 10 deletions
|
@ -572,23 +572,22 @@ static int SpawnableSort(const void *a, const void *b)
|
||||||
static void DumpClassMap(FClassMap &themap)
|
static void DumpClassMap(FClassMap &themap)
|
||||||
{
|
{
|
||||||
FClassMap::Iterator it(themap);
|
FClassMap::Iterator it(themap);
|
||||||
FClassMap::Pair *pair, **allpairs;
|
FClassMap::Pair *pair;
|
||||||
|
TArray<FClassMap::Pair*> allpairs(themap.CountUsed(), true);
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
// Sort into numerical order, since their arrangement in the map can
|
// Sort into numerical order, since their arrangement in the map can
|
||||||
// be in an unspecified order.
|
// be in an unspecified order.
|
||||||
allpairs = new FClassMap::Pair *[themap.CountUsed()];
|
|
||||||
while (it.NextPair(pair))
|
while (it.NextPair(pair))
|
||||||
{
|
{
|
||||||
allpairs[i++] = pair;
|
allpairs[i++] = pair;
|
||||||
}
|
}
|
||||||
qsort(allpairs, i, sizeof(*allpairs), SpawnableSort);
|
qsort(allpairs.Data, i, sizeof(allpairs[0]), SpawnableSort);
|
||||||
for (int j = 0; j < i; ++j)
|
for (int j = 0; j < i; ++j)
|
||||||
{
|
{
|
||||||
pair = allpairs[j];
|
pair = allpairs[j];
|
||||||
Printf ("%d %s\n", pair->Key, pair->Value->TypeName.GetChars());
|
Printf ("%d %s\n", pair->Key, pair->Value->TypeName.GetChars());
|
||||||
}
|
}
|
||||||
delete[] allpairs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CCMD(dumpspawnables)
|
CCMD(dumpspawnables)
|
||||||
|
|
|
@ -429,12 +429,8 @@ void player_t::SetLogNumber (int num)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int length=Wads.LumpLength(lumpnum);
|
auto lump = Wads.ReadLump(lumpnum);
|
||||||
char *data= new char[length+1];
|
SetLogText (lump.GetString());
|
||||||
Wads.ReadLump (lumpnum, data);
|
|
||||||
data[length]=0;
|
|
||||||
SetLogText (data);
|
|
||||||
delete[] data;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue