mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-30 07:41:22 +00:00
- Fixed AInventory::PickupFlash setting with GCC.
- Fixed: The MusicVolumes list was allocated with M_Malloc but freed with delete. - Fixed: demobuffer was inconsistantly handled with new[]/delete[] and malloc/free. - Added used memory tracking to M_Malloc() and M_Realloc(). This necessitated the addition of an M_Free() call to track frees. - Removed M_Calloc since it was only used in one place, and can just as well be done with an M_Malloc/memset pair. - Bumped DEMOGAMEVERSION for the new net controller codes. SVN r751 (trunk)
This commit is contained in:
parent
39bff11693
commit
133350fb9c
29 changed files with 193 additions and 109 deletions
|
@ -1,18 +1,34 @@
|
||||||
|
February 16, 2008
|
||||||
|
- Fixed AInventory::PickupFlash setting with GCC.
|
||||||
|
- Fixed: The MusicVolumes list was allocated with M_Malloc but freed with
|
||||||
|
delete.
|
||||||
|
- Fixed: demobuffer was inconsistantly handled with new[]/delete[] and
|
||||||
|
malloc/free.
|
||||||
|
- Added used memory tracking to M_Malloc() and M_Realloc(). This
|
||||||
|
necessitated the addition of an M_Free() call to track frees.
|
||||||
|
- Removed M_Calloc since it was only used in one place, and can just as well
|
||||||
|
be done with an M_Malloc/memset pair.
|
||||||
|
- Bumped DEMOGAMEVERSION for the new net controller codes.
|
||||||
|
|
||||||
February 16, 2008 (Changes by Graf Zahl)
|
February 16, 2008 (Changes by Graf Zahl)
|
||||||
- Added patch by Karate Chris:
|
- Added patch by Karate Chris:
|
||||||
- The net arbitrator can add or remove players to an access list so they
|
- The net arbitrator can add or remove players to an access list so they
|
||||||
can or cannot control game settings:
|
can or cannot control game settings:
|
||||||
* net_addcontroller <player number> - Adds a player to the control list. Only net arbitrators have access to this command.
|
* net_addcontroller <player number> - Adds a player to the control list.
|
||||||
* net_removecontroller <player number> - Removes a player from the control list. Only net arbitrators have access to this command.
|
Only net arbitrators have access to this command.
|
||||||
* net_listcontrollers - Lists the players who are able to control the game settings.
|
* net_removecontroller <player number> - Removes a player from the control
|
||||||
- Fixed: The 'Printf'' occurrences in the 'addplayerclass' console command were all missing a '\n' at the end.
|
list. Only net arbitrators have access to this command.
|
||||||
- Enhanced the 'playerinfo' console command so more information about each setting is shown.
|
* net_listcontrollers - Lists the players who are able to control the game
|
||||||
|
settings.
|
||||||
|
- Fixed: The 'Printf' occurrences in the 'addplayerclass' console command
|
||||||
|
were all missing a '\n' at the end.
|
||||||
|
- Enhanced the 'playerinfo' console command so more information about each
|
||||||
|
setting is shown.
|
||||||
- Added customizable pickup flash.
|
- Added customizable pickup flash.
|
||||||
- Added option to show shorter messages for save game and screenshot confirmation.
|
- Added option to show shorter messages for save game and screenshot confirmation.
|
||||||
Also added this to the 'Messages' menu.
|
Also added this to the 'Messages' menu.
|
||||||
|
|
||||||
February 15, 2008
|
February 14, 2008
|
||||||
- Version bump to 2.2.0.
|
- Version bump to 2.2.0.
|
||||||
- Disabled console alpha when the console is fullscreen.
|
- Disabled console alpha when the console is fullscreen.
|
||||||
- Re-enabled maybedrawnow for the software renderer. This should be replaced
|
- Re-enabled maybedrawnow for the software renderer. This should be replaced
|
||||||
|
|
|
@ -449,7 +449,7 @@ void C_DeinitConsole ()
|
||||||
{
|
{
|
||||||
GameAtExit *next = cmd->Next;
|
GameAtExit *next = cmd->Next;
|
||||||
AddCommandString (cmd->Command);
|
AddCommandString (cmd->Command);
|
||||||
free (cmd);
|
M_Free (cmd);
|
||||||
cmd = next;
|
cmd = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1675,7 +1675,7 @@ static bool C_HandleKey (event_t *ev, BYTE *buffer, int len)
|
||||||
if (HistSize == MAXHISTSIZE)
|
if (HistSize == MAXHISTSIZE)
|
||||||
{
|
{
|
||||||
HistTail = HistTail->Newer;
|
HistTail = HistTail->Newer;
|
||||||
free (HistTail->Older);
|
M_Free (HistTail->Older);
|
||||||
HistTail->Older = NULL;
|
HistTail->Older = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -233,8 +233,8 @@ missing:
|
||||||
Printf ("Missing argument to %s\n", token);
|
Printf ("Missing argument to %s\n", token);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (prod2 != NULL) free (prod2);
|
if (prod2 != NULL) M_Free (prod2);
|
||||||
if (prod1 != NULL) free (prod1);
|
if (prod1 != NULL) M_Free (prod1);
|
||||||
return prod3;
|
return prod3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ static FStringProd *DoubleToString (FProduction *prod)
|
||||||
|
|
||||||
sprintf (buf, "%g", static_cast<FDoubleProd *>(prod)->Value);
|
sprintf (buf, "%g", static_cast<FDoubleProd *>(prod)->Value);
|
||||||
newprod = NewStringProd (buf);
|
newprod = NewStringProd (buf);
|
||||||
free (prod);
|
M_Free (prod);
|
||||||
return newprod;
|
return newprod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ static FDoubleProd *StringToDouble (FProduction *prod)
|
||||||
FDoubleProd *newprod;
|
FDoubleProd *newprod;
|
||||||
|
|
||||||
newprod = NewDoubleProd (atof (static_cast<FStringProd *>(prod)->Value));
|
newprod = NewDoubleProd (atof (static_cast<FStringProd *>(prod)->Value));
|
||||||
free (prod);
|
M_Free (prod);
|
||||||
return newprod;
|
return newprod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +746,7 @@ CCMD (test)
|
||||||
}
|
}
|
||||||
if (prod != NULL)
|
if (prod != NULL)
|
||||||
{
|
{
|
||||||
free (prod);
|
M_Free (prod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +802,7 @@ CCMD (eval)
|
||||||
Printf ("%s\n", static_cast<FStringProd *>(prod)->Value);
|
Printf ("%s\n", static_cast<FStringProd *>(prod)->Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free (prod);
|
M_Free (prod);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,7 @@ static struct TicSpecial
|
||||||
{
|
{
|
||||||
if (streams[i])
|
if (streams[i])
|
||||||
{
|
{
|
||||||
free (streams[i]);
|
M_Free (streams[i]);
|
||||||
streams[i] = NULL;
|
streams[i] = NULL;
|
||||||
used[i] = 0;
|
used[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,7 @@ public:
|
||||||
|
|
||||||
void operator delete (void *mem)
|
void operator delete (void *mem)
|
||||||
{
|
{
|
||||||
free (mem);
|
M_Free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -305,7 +305,7 @@ void PClass::FreeStateList ()
|
||||||
if (ActorInfo != NULL && ActorInfo->StateList != NULL)
|
if (ActorInfo != NULL && ActorInfo->StateList != NULL)
|
||||||
{
|
{
|
||||||
ActorInfo->StateList->Destroy();
|
ActorInfo->StateList->Destroy();
|
||||||
free (ActorInfo->StateList);
|
M_Free (ActorInfo->StateList);
|
||||||
ActorInfo->StateList = NULL;
|
ActorInfo->StateList = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,10 @@ void FCompressedFile::Close ()
|
||||||
m_File = NULL;
|
m_File = NULL;
|
||||||
}
|
}
|
||||||
if (m_Buffer)
|
if (m_Buffer)
|
||||||
free (m_Buffer);
|
{
|
||||||
|
M_Free (m_Buffer);
|
||||||
|
m_Buffer = NULL;
|
||||||
|
}
|
||||||
BeEmpty ();
|
BeEmpty ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,7 +375,7 @@ void FCompressedFile::Implode ()
|
||||||
memcpy (m_Buffer + 8, compressed, outlen);
|
memcpy (m_Buffer + 8, compressed, outlen);
|
||||||
if (compressed)
|
if (compressed)
|
||||||
delete[] compressed;
|
delete[] compressed;
|
||||||
free (oldbuf);
|
M_Free (oldbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FCompressedFile::Explode ()
|
void FCompressedFile::Explode ()
|
||||||
|
@ -396,7 +399,7 @@ void FCompressedFile::Explode ()
|
||||||
r = uncompress (expand, &newlen, m_Buffer + 8, cprlen);
|
r = uncompress (expand, &newlen, m_Buffer + 8, cprlen);
|
||||||
if (r != Z_OK || newlen != expandsize)
|
if (r != Z_OK || newlen != expandsize)
|
||||||
{
|
{
|
||||||
free (expand);
|
M_Free (expand);
|
||||||
I_Error ("Could not decompress cfile");
|
I_Error ("Could not decompress cfile");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -405,7 +408,7 @@ void FCompressedFile::Explode ()
|
||||||
memcpy (expand, m_Buffer + 8, expandsize);
|
memcpy (expand, m_Buffer + 8, expandsize);
|
||||||
}
|
}
|
||||||
if (FreeOnExplode ())
|
if (FreeOnExplode ())
|
||||||
free (m_Buffer);
|
M_Free (m_Buffer);
|
||||||
m_Buffer = expand;
|
m_Buffer = expand;
|
||||||
m_BufferSize = expandsize;
|
m_BufferSize = expandsize;
|
||||||
}
|
}
|
||||||
|
@ -430,7 +433,7 @@ FCompressedMemFile::~FCompressedMemFile ()
|
||||||
{
|
{
|
||||||
if (m_ImplodedBuffer != NULL)
|
if (m_ImplodedBuffer != NULL)
|
||||||
{
|
{
|
||||||
free (m_ImplodedBuffer);
|
M_Free (m_ImplodedBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -672,7 +675,7 @@ FArchive::~FArchive ()
|
||||||
if (m_TypeMap)
|
if (m_TypeMap)
|
||||||
delete[] m_TypeMap;
|
delete[] m_TypeMap;
|
||||||
if (m_ObjectMap)
|
if (m_ObjectMap)
|
||||||
free (m_ObjectMap);
|
M_Free (m_ObjectMap);
|
||||||
if (m_SpriteMap)
|
if (m_SpriteMap)
|
||||||
delete[] m_SpriteMap;
|
delete[] m_SpriteMap;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2436,7 +2436,7 @@ bool G_ProcessIFFDemo (char *mapname)
|
||||||
delete[] uncompressed;
|
delete[] uncompressed;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
delete[] demobuffer;
|
M_Free (demobuffer);
|
||||||
zdembodyend = uncompressed + uncompSize;
|
zdembodyend = uncompressed + uncompSize;
|
||||||
demobuffer = demo_p = uncompressed;
|
demobuffer = demo_p = uncompressed;
|
||||||
}
|
}
|
||||||
|
@ -2456,7 +2456,7 @@ void G_DoPlayDemo (void)
|
||||||
if (demolump >= 0)
|
if (demolump >= 0)
|
||||||
{
|
{
|
||||||
int demolen = Wads.LumpLength (demolump);
|
int demolen = Wads.LumpLength (demolump);
|
||||||
demobuffer = new BYTE[demolen];
|
demobuffer = (BYTE *)M_Malloc(demolen);
|
||||||
Wads.ReadLump (demolump, demobuffer);
|
Wads.ReadLump (demolump, demobuffer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2547,7 +2547,7 @@ bool G_CheckDemoStatus (void)
|
||||||
|
|
||||||
C_RestoreCVars (); // [RH] Restore cvars demo might have changed
|
C_RestoreCVars (); // [RH] Restore cvars demo might have changed
|
||||||
|
|
||||||
delete[] demobuffer;
|
M_Free (demobuffer);
|
||||||
demoplayback = false;
|
demoplayback = false;
|
||||||
netdemo = false;
|
netdemo = false;
|
||||||
netgame = false;
|
netgame = false;
|
||||||
|
@ -2620,7 +2620,7 @@ bool G_CheckDemoStatus (void)
|
||||||
WriteLong (demo_p - demobuffer - 8, &formlen);
|
WriteLong (demo_p - demobuffer - 8, &formlen);
|
||||||
|
|
||||||
M_WriteFile (demoname, demobuffer, demo_p - demobuffer);
|
M_WriteFile (demoname, demobuffer, demo_p - demobuffer);
|
||||||
free (demobuffer);
|
M_Free (demobuffer);
|
||||||
demorecording = false;
|
demorecording = false;
|
||||||
stoprecording = false;
|
stoprecording = false;
|
||||||
Printf ("Demo %s recorded\n", demoname);
|
Printf ("Demo %s recorded\n", demoname);
|
||||||
|
|
|
@ -255,7 +255,7 @@ static void ApplyActorDefault (int defnum, const char *datastr, int dataint)
|
||||||
|
|
||||||
case ADEF_Inventory_FlagsSet: item->ItemFlags |= dataint; break;
|
case ADEF_Inventory_FlagsSet: item->ItemFlags |= dataint; break;
|
||||||
case ADEF_Inventory_FlagsClear: item->ItemFlags &= ~dataint; break;
|
case ADEF_Inventory_FlagsClear: item->ItemFlags &= ~dataint; break;
|
||||||
case ADEF_Inventory_PickupFlash:item->PickupFlash = dataint? fuglyname("PickupFlash") : NULL;
|
case ADEF_Inventory_PickupFlash:if(dataint) { item->PickupFlash = fuglyname("PickupFlash"); } else { item->PickupFlash = NULL; } break;
|
||||||
case ADEF_Inventory_Amount: item->Amount = dataint; break;
|
case ADEF_Inventory_Amount: item->Amount = dataint; break;
|
||||||
case ADEF_Inventory_RespawnTics:item->RespawnTics = dataint; break;
|
case ADEF_Inventory_RespawnTics:item->RespawnTics = dataint; break;
|
||||||
case ADEF_Inventory_MaxAmount: item->MaxAmount = dataint; break;
|
case ADEF_Inventory_MaxAmount: item->MaxAmount = dataint; break;
|
||||||
|
|
116
src/m_alloc.cpp
116
src/m_alloc.cpp
|
@ -1,9 +1,9 @@
|
||||||
/*
|
/*
|
||||||
** m_alloc.cpp
|
** m_alloc.cpp
|
||||||
** Wrappers for the malloc family of functions
|
** Wrappers for the malloc family of functions that count used bytes.
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 1998-2006 Randy Heit
|
** Copyright 1998-2008 Randy Heit
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -32,39 +32,93 @@
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !defined(_DEBUG) || !defined(_MSC_VER)
|
|
||||||
|
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "m_alloc.h"
|
|
||||||
|
|
||||||
void *M_Malloc (size_t size)
|
#include "stats.h"
|
||||||
|
|
||||||
|
ADD_STAT(mem)
|
||||||
{
|
{
|
||||||
void *zone = malloc (size);
|
FString out;
|
||||||
|
out.Format("Alloc: %uKB", (AllocBytes + 1023) >> 10);
|
||||||
if (!zone)
|
return out;
|
||||||
I_FatalError ("Could not malloc %u bytes", size);
|
|
||||||
|
|
||||||
return zone;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void *M_Calloc (size_t num, size_t size)
|
size_t AllocBytes;
|
||||||
{
|
|
||||||
void *zone = calloc (num, size);
|
|
||||||
|
|
||||||
if (!zone)
|
|
||||||
I_FatalError ("Could not calloc %u bytes", num * size);
|
|
||||||
|
|
||||||
return zone;
|
|
||||||
}
|
|
||||||
|
|
||||||
void *M_Realloc (void *memblock, size_t size)
|
|
||||||
{
|
|
||||||
void *zone = realloc (memblock, size);
|
|
||||||
|
|
||||||
if (!zone)
|
|
||||||
I_FatalError ("Could not realloc %u bytes", size);
|
|
||||||
|
|
||||||
return zone;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#define _NORMAL_BLOCK 0
|
||||||
|
#define _malloc_dbg(s,b,f,l) malloc(s)
|
||||||
|
#define _realloc_dbg(p,s,b,f,l) realloc(p,s)
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef _WIN32
|
||||||
|
#define _msize(p) malloc_usable_size(p) // from glibc/FreeBSD
|
||||||
|
#else
|
||||||
|
#include <malloc.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef _DEBUG
|
||||||
|
void *M_Malloc(size_t size)
|
||||||
|
{
|
||||||
|
void *block = malloc(size);
|
||||||
|
|
||||||
|
if (block == NULL)
|
||||||
|
I_FatalError("Could not malloc %u bytes", size);
|
||||||
|
|
||||||
|
AllocBytes += _msize(block);
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *M_Realloc(void *memblock, size_t size)
|
||||||
|
{
|
||||||
|
if (memblock != NULL)
|
||||||
|
{
|
||||||
|
AllocBytes -= _msize(memblock);
|
||||||
|
}
|
||||||
|
void *block = realloc(memblock, size);
|
||||||
|
if (block == NULL)
|
||||||
|
{
|
||||||
|
I_FatalError("Could not realloc %u bytes", size);
|
||||||
|
}
|
||||||
|
AllocBytes += _msize(block);
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <crtdbg.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void *M_Malloc_Dbg(size_t size, const char *file, int lineno)
|
||||||
|
{
|
||||||
|
void *block = _malloc_dbg(size, _NORMAL_BLOCK, file, lineno);
|
||||||
|
|
||||||
|
if (block == NULL)
|
||||||
|
I_FatalError("Could not malloc %u bytes", size);
|
||||||
|
|
||||||
|
AllocBytes += _msize(block);
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *M_Realloc_Dbg(void *memblock, size_t size, const char *file, int lineno)
|
||||||
|
{
|
||||||
|
if (memblock != NULL)
|
||||||
|
{
|
||||||
|
AllocBytes -= _msize(memblock);
|
||||||
|
}
|
||||||
|
void *block = _realloc_dbg(memblock, size, _NORMAL_BLOCK, file, lineno);
|
||||||
|
if (block == NULL)
|
||||||
|
{
|
||||||
|
I_FatalError("Could not realloc %u bytes", size);
|
||||||
|
}
|
||||||
|
AllocBytes += _msize(block);
|
||||||
|
return block;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void M_Free (void *block)
|
||||||
|
{
|
||||||
|
if (block != NULL)
|
||||||
|
{
|
||||||
|
AllocBytes -= _msize(block);
|
||||||
|
free(block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
** m_alloc.h
|
** m_alloc.h
|
||||||
**
|
**
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
** Copyright 1998-2006 Randy Heit
|
** Copyright 1998-2008 Randy Heit
|
||||||
** All rights reserved.
|
** All rights reserved.
|
||||||
**
|
**
|
||||||
** Redistribution and use in source and binary forms, with or without
|
** Redistribution and use in source and binary forms, with or without
|
||||||
|
@ -34,26 +34,26 @@
|
||||||
#ifndef __M_ALLOC_H__
|
#ifndef __M_ALLOC_H__
|
||||||
#define __M_ALLOC_H__
|
#define __M_ALLOC_H__
|
||||||
|
|
||||||
#if !defined(_DEBUG) || !defined(_MSC_VER)
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
// These are the same as the same stdlib functions,
|
// These are the same as the same stdlib functions,
|
||||||
// except they bomb out with an error requester
|
// except they bomb out with a fatal error
|
||||||
// when they can't get the memory.
|
// when they can't get the memory.
|
||||||
|
|
||||||
void *M_Malloc (size_t size);
|
#if defined(_DEBUG)
|
||||||
void *M_Calloc (size_t num, size_t size);
|
#define M_Malloc(s) M_Malloc_Dbg(s, __FILE__, __LINE__)
|
||||||
void *M_Realloc (void *memblock, size_t size);
|
#define M_Realloc(p,s) M_Realloc_Dbg(p, s, __FILE__, __LINE__)
|
||||||
|
|
||||||
|
void *M_Malloc_Dbg (size_t size, const char *file, int lineno);
|
||||||
|
void *M_Realloc_Dbg (void *memblock, size_t size, const char *file, int lineno);
|
||||||
#else
|
#else
|
||||||
|
void *M_Malloc (size_t size);
|
||||||
#include <stdlib.h>
|
void *M_Realloc (void *memblock, size_t size);
|
||||||
#include <crtdbg.h>
|
|
||||||
|
|
||||||
#define M_Malloc(size) malloc(size)
|
|
||||||
#define M_Calloc(num, size) calloc(num, size)
|
|
||||||
#define M_Realloc(memblock, size) realloc(memblock, size)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
void M_Free (void *memblock);
|
||||||
|
|
||||||
|
// Number of bytes currently allocated through M_Malloc/M_Realloc
|
||||||
|
extern size_t AllocBytes;
|
||||||
|
|
||||||
#endif //__M_ALLOC_H__
|
#endif //__M_ALLOC_H__
|
||||||
|
|
|
@ -270,13 +270,13 @@ FName::NameManager::~NameManager()
|
||||||
for (block = Blocks; block != NULL; block = next)
|
for (block = Blocks; block != NULL; block = next)
|
||||||
{
|
{
|
||||||
next = block->NextBlock;
|
next = block->NextBlock;
|
||||||
free (block);
|
M_Free (block);
|
||||||
}
|
}
|
||||||
Blocks = NULL;
|
Blocks = NULL;
|
||||||
|
|
||||||
if (NameArray != NULL)
|
if (NameArray != NULL)
|
||||||
{
|
{
|
||||||
free (NameArray);
|
M_Free (NameArray);
|
||||||
NameArray = NULL;
|
NameArray = NULL;
|
||||||
}
|
}
|
||||||
NumNames = MaxNames = 0;
|
NumNames = MaxNames = 0;
|
||||||
|
|
|
@ -3369,7 +3369,7 @@ void P_FreeExtraLevelData()
|
||||||
while (node != NULL)
|
while (node != NULL)
|
||||||
{
|
{
|
||||||
msecnode_t *next = node->m_snext;
|
msecnode_t *next = node->m_snext;
|
||||||
free (node);
|
M_Free (node);
|
||||||
node = next;
|
node = next;
|
||||||
}
|
}
|
||||||
headsecnode = NULL;
|
headsecnode = NULL;
|
||||||
|
|
|
@ -121,8 +121,11 @@ public:
|
||||||
{
|
{
|
||||||
for(unsigned i=0;i<Size();i++)
|
for(unsigned i=0;i<Size();i++)
|
||||||
{
|
{
|
||||||
if ((*this)[i] != NULL) free((*this)[i]);
|
if ((*this)[i] != NULL)
|
||||||
(*this)[i]=NULL;
|
{
|
||||||
|
M_Free((*this)[i]);
|
||||||
|
(*this)[i] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -620,7 +620,7 @@ AnimArray::~AnimArray()
|
||||||
{
|
{
|
||||||
if ((*this)[i] != NULL)
|
if ((*this)[i] != NULL)
|
||||||
{
|
{
|
||||||
free ((*this)[i]);
|
M_Free ((*this)[i]);
|
||||||
(*this)[i] = NULL;
|
(*this)[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -388,14 +388,14 @@ void R_DeinitData ()
|
||||||
// Free openings
|
// Free openings
|
||||||
if (openings != NULL)
|
if (openings != NULL)
|
||||||
{
|
{
|
||||||
free (openings);
|
M_Free (openings);
|
||||||
openings = NULL;
|
openings = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free drawsegs
|
// Free drawsegs
|
||||||
if (drawsegs != NULL)
|
if (drawsegs != NULL)
|
||||||
{
|
{
|
||||||
free (drawsegs);
|
M_Free (drawsegs);
|
||||||
drawsegs = NULL;
|
drawsegs = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -491,7 +491,8 @@ static visplane_t *new_visplane (unsigned hash)
|
||||||
|
|
||||||
if (check == NULL)
|
if (check == NULL)
|
||||||
{
|
{
|
||||||
check = (visplane_t *)M_Calloc (1, sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2));
|
check = (visplane_t *)M_Malloc (sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2));
|
||||||
|
memset(check, 0, sizeof(*check) + sizeof(*check->top)*(MAXWIDTH*2));
|
||||||
check->bottom = &check->top[MAXWIDTH+2];
|
check->bottom = &check->top[MAXWIDTH+2];
|
||||||
}
|
}
|
||||||
else if (NULL == (freetail = freetail->next))
|
else if (NULL == (freetail = freetail->next))
|
||||||
|
@ -1637,7 +1638,7 @@ bool R_PlaneInitData ()
|
||||||
while (pl)
|
while (pl)
|
||||||
{
|
{
|
||||||
visplane_t *next = pl->next;
|
visplane_t *next = pl->next;
|
||||||
free (pl);
|
M_Free (pl);
|
||||||
pl = next;
|
pl = next;
|
||||||
}
|
}
|
||||||
freetail = NULL;
|
freetail = NULL;
|
||||||
|
@ -1650,7 +1651,7 @@ bool R_PlaneInitData ()
|
||||||
while (pl)
|
while (pl)
|
||||||
{
|
{
|
||||||
visplane_t *next = pl->next;
|
visplane_t *next = pl->next;
|
||||||
free (pl);
|
M_Free (pl);
|
||||||
pl = next;
|
pl = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ void FRemapTable::Free()
|
||||||
KillNative();
|
KillNative();
|
||||||
if (Remap != NULL)
|
if (Remap != NULL)
|
||||||
{
|
{
|
||||||
free(Remap);
|
M_Free(Remap);
|
||||||
Remap = NULL;
|
Remap = NULL;
|
||||||
Palette = NULL;
|
Palette = NULL;
|
||||||
NumEntries = 0;
|
NumEntries = 0;
|
||||||
|
|
|
@ -778,7 +778,7 @@ static void S_ClearSoundData()
|
||||||
{
|
{
|
||||||
FMusicVolume *me = MusicVolumes;
|
FMusicVolume *me = MusicVolumes;
|
||||||
MusicVolumes = me->Next;
|
MusicVolumes = me->Next;
|
||||||
delete me;
|
M_Free(me);
|
||||||
}
|
}
|
||||||
S_rnd.Clear();
|
S_rnd.Clear();
|
||||||
|
|
||||||
|
|
|
@ -154,7 +154,7 @@ struct FSoundSequencePtrArray : public TArray<FSoundSequence *>
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < Size(); ++i)
|
for (unsigned int i = 0; i < Size(); ++i)
|
||||||
{
|
{
|
||||||
free ((*this)[i]);
|
M_Free ((*this)[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -463,7 +463,7 @@ void S_ParseSndSeq (int levellump)
|
||||||
{
|
{
|
||||||
if (Sequences[i])
|
if (Sequences[i])
|
||||||
{
|
{
|
||||||
free(Sequences[i]);
|
M_Free(Sequences[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Sequences.Clear();
|
Sequences.Clear();
|
||||||
|
@ -496,7 +496,7 @@ void S_ParseSndSeq (int levellump)
|
||||||
{
|
{
|
||||||
if (Sequences[curseq]->SeqName == seqname)
|
if (Sequences[curseq]->SeqName == seqname)
|
||||||
{
|
{
|
||||||
free (Sequences[curseq]);
|
M_Free (Sequences[curseq]);
|
||||||
Sequences[curseq] = NULL;
|
Sequences[curseq] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ void FStringTable::FreeData ()
|
||||||
while (entry != NULL)
|
while (entry != NULL)
|
||||||
{
|
{
|
||||||
next = entry->Next;
|
next = entry->Next;
|
||||||
free (entry);
|
M_Free (entry);
|
||||||
entry = next;
|
entry = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ void FStringTable::FreeNonDehackedStrings ()
|
||||||
if (entry->PassNum != 0)
|
if (entry->PassNum != 0)
|
||||||
{
|
{
|
||||||
*pentry = next;
|
*pentry = next;
|
||||||
free (entry);
|
M_Free (entry);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -254,7 +254,7 @@ void FStringTable::LoadLanguage (int lumpnum, DWORD code, bool exactMatch, int p
|
||||||
if (cmpval == 0 && entry->PassNum >= passnum)
|
if (cmpval == 0 && entry->PassNum >= passnum)
|
||||||
{
|
{
|
||||||
*pentry = entry->Next;
|
*pentry = entry->Next;
|
||||||
free (entry);
|
M_Free (entry);
|
||||||
entry = NULL;
|
entry = NULL;
|
||||||
}
|
}
|
||||||
if (entry == NULL || cmpval > 0)
|
if (entry == NULL || cmpval > 0)
|
||||||
|
@ -396,6 +396,6 @@ void FStringTable::SetString (const char *name, const char *newString)
|
||||||
{
|
{
|
||||||
*pentry = entry;
|
*pentry = entry;
|
||||||
entry->Next = oentry->Next;
|
entry->Next = oentry->Next;
|
||||||
free (oentry);
|
M_Free (oentry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
10
src/tarray.h
10
src/tarray.h
|
@ -89,7 +89,7 @@ public:
|
||||||
{
|
{
|
||||||
DoDelete (0, Count-1);
|
DoDelete (0, Count-1);
|
||||||
}
|
}
|
||||||
free (Array);
|
M_Free (Array);
|
||||||
}
|
}
|
||||||
DoCopy (other);
|
DoCopy (other);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
{
|
{
|
||||||
DoDelete (0, Count-1);
|
DoDelete (0, Count-1);
|
||||||
}
|
}
|
||||||
free (Array);
|
M_Free (Array);
|
||||||
Array = NULL;
|
Array = NULL;
|
||||||
Count = 0;
|
Count = 0;
|
||||||
Most = 0;
|
Most = 0;
|
||||||
|
@ -178,7 +178,7 @@ public:
|
||||||
{
|
{
|
||||||
if (Array != NULL)
|
if (Array != NULL)
|
||||||
{
|
{
|
||||||
free (Array);
|
M_Free (Array);
|
||||||
Array = NULL;
|
Array = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -604,7 +604,7 @@ protected:
|
||||||
Nodes[i].~Node();
|
Nodes[i].~Node();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(Nodes);
|
M_Free(Nodes);
|
||||||
Nodes = NULL;
|
Nodes = NULL;
|
||||||
Size = 0;
|
Size = 0;
|
||||||
LastFree = NULL;
|
LastFree = NULL;
|
||||||
|
@ -628,7 +628,7 @@ protected:
|
||||||
nold[i].~Node();
|
nold[i].~Node();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(nold);
|
M_Free(nold);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Rehash()
|
void Rehash()
|
||||||
|
|
|
@ -99,15 +99,15 @@ bool FRawPageTexture::Check(FileReader & data)
|
||||||
}
|
}
|
||||||
if (gapAtStart || (x != width))
|
if (gapAtStart || (x != width))
|
||||||
{
|
{
|
||||||
free (foo);
|
M_Free (foo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
free(foo);
|
M_Free(foo);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
free (foo);
|
M_Free (foo);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,7 +266,7 @@ FTexture::Span **FTexture::CreateSpans (const BYTE *pixels) const
|
||||||
|
|
||||||
void FTexture::FreeSpans (Span **spans) const
|
void FTexture::FreeSpans (Span **spans) const
|
||||||
{
|
{
|
||||||
free (spans);
|
M_Free (spans);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, const BYTE *translation)
|
void FTexture::CopyToBlock (BYTE *dest, int dwidth, int dheight, int xpos, int ypos, const BYTE *translation)
|
||||||
|
|
|
@ -401,7 +401,14 @@ static void HandleDeprecatedFlags(AActor *defaults, bool set, int index)
|
||||||
defaults->meleethreshold = set? 196*FRACUNIT : 0;
|
defaults->meleethreshold = set? 196*FRACUNIT : 0;
|
||||||
break;
|
break;
|
||||||
case 5: // INVENTORY.PICKUPFLASH
|
case 5: // INVENTORY.PICKUPFLASH
|
||||||
static_cast<AInventory*>(defaults)->PickupFlash = set? fuglyname("PickupFlash") : NULL;
|
if (set)
|
||||||
|
{
|
||||||
|
static_cast<AInventory*>(defaults)->PickupFlash = fuglyname("PickupFlash");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static_cast<AInventory*>(defaults)->PickupFlash = NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break; // silence GCC
|
break; // silence GCC
|
||||||
|
|
|
@ -331,7 +331,7 @@ void InstallStates(FActorInfo *info, AActor *defaults)
|
||||||
if (info->StateList != NULL)
|
if (info->StateList != NULL)
|
||||||
{
|
{
|
||||||
info->StateList->Destroy();
|
info->StateList->Destroy();
|
||||||
free(info->StateList);
|
M_Free(info->StateList);
|
||||||
}
|
}
|
||||||
info->StateList = CreateStateLabelList(StateLabels);
|
info->StateList = CreateStateLabelList(StateLabels);
|
||||||
|
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
// Protocol version used in demos.
|
// Protocol version used in demos.
|
||||||
// Bump it if you change existing DEM_ commands or add new ones.
|
// Bump it if you change existing DEM_ commands or add new ones.
|
||||||
// Otherwise, it should be safe to leave it alone.
|
// Otherwise, it should be safe to leave it alone.
|
||||||
#define DEMOGAMEVERSION 0x209
|
#define DEMOGAMEVERSION 0x20A
|
||||||
|
|
||||||
// Minimum demo version we can play.
|
// Minimum demo version we can play.
|
||||||
// Bump it whenever you change or remove existing DEM_ commands.
|
// Bump it whenever you change or remove existing DEM_ commands.
|
||||||
|
|
|
@ -228,7 +228,7 @@ void FWadCollection::InitMultipleFiles (wadlist_t **filenames)
|
||||||
DefaultExtension (name, ".wad");
|
DefaultExtension (name, ".wad");
|
||||||
|
|
||||||
AddFile (name);
|
AddFile (name);
|
||||||
free (*filenames);
|
M_Free (*filenames);
|
||||||
*filenames = next;
|
*filenames = next;
|
||||||
|
|
||||||
// The first two files are always zdoom.wad and the IWAD, which
|
// The first two files are always zdoom.wad and the IWAD, which
|
||||||
|
@ -305,7 +305,7 @@ static DWORD Zip_FindCentralDir(FileReader * fin)
|
||||||
FileSize = fin->Tell();
|
FileSize = fin->Tell();
|
||||||
uMaxBack = MIN<DWORD>(0xffff, FileSize);
|
uMaxBack = MIN<DWORD>(0xffff, FileSize);
|
||||||
|
|
||||||
buf = (unsigned char*)M_Malloc(BUFREADCOMMENT+4);
|
buf = (unsigned char*)malloc(BUFREADCOMMENT+4);
|
||||||
if (buf == NULL) return 0;
|
if (buf == NULL) return 0;
|
||||||
|
|
||||||
uBackRead = 4;
|
uBackRead = 4;
|
||||||
|
|
|
@ -1437,7 +1437,7 @@ BYTE *ST_Util_BitsForBitmap (BITMAPINFO *bitmap_info)
|
||||||
|
|
||||||
void ST_Util_FreeBitmap (BITMAPINFO *bitmap_info)
|
void ST_Util_FreeBitmap (BITMAPINFO *bitmap_info)
|
||||||
{
|
{
|
||||||
free (bitmap_info);
|
M_Free (bitmap_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue