Even more conversion, lots of superfluous macro removal
This commit is contained in:
+13
-12
@@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
// zone.c
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "quakedef.hpp"
|
||||
|
||||
#define DYNAMIC_SIZE (4 * 1024 * 1024) // ericw -- was 512KB (64-bit) / 384KB (32-bit)
|
||||
@@ -203,7 +205,7 @@ void *Z_Malloc (int size)
|
||||
buf = Z_TagMalloc (size, 1);
|
||||
if (!buf)
|
||||
Sys_Error ("Z_Malloc: failed on allocation of %i bytes",size);
|
||||
Q_memset (buf, 0, size);
|
||||
std::memset (buf, 0, size);
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -300,7 +302,7 @@ int hunk_size;
|
||||
int hunk_low_used;
|
||||
int hunk_high_used;
|
||||
|
||||
qboolean hunk_tempactive;
|
||||
bool hunk_tempactive;
|
||||
int hunk_tempmark;
|
||||
|
||||
/*
|
||||
@@ -332,7 +334,7 @@ If "all" is specified, every single allocation is printed.
|
||||
Otherwise, allocations with the same name will be totaled up before printing.
|
||||
==============
|
||||
*/
|
||||
void Hunk_Print (qboolean all)
|
||||
void Hunk_Print (bool all)
|
||||
{
|
||||
hunk_t *h, *next, *endlow, *starthigh, *endhigh;
|
||||
int count, sum;
|
||||
@@ -601,7 +603,7 @@ typedef struct cache_system_s
|
||||
struct cache_system_s *lru_prev, *lru_next; // for LRU flushing
|
||||
} cache_system_t;
|
||||
|
||||
cache_system_t *Cache_TryAlloc (int size, qboolean nobottom);
|
||||
cache_system_t *Cache_TryAlloc (int size, bool nobottom);
|
||||
|
||||
cache_system_t cache_head;
|
||||
|
||||
@@ -620,9 +622,9 @@ void Cache_Move ( cache_system_t *c)
|
||||
{
|
||||
// Con_Printf ("cache_move ok\n");
|
||||
|
||||
Q_memcpy ( new_cs+1, c+1, c->size - sizeof(cache_system_t) );
|
||||
std::memcpy ( new_cs+1, c+1, c->size - sizeof(cache_system_t) );
|
||||
new_cs->user = c->user;
|
||||
Q_memcpy (new_cs->name, c->name, sizeof(new_cs->name));
|
||||
std::memcpy (new_cs->name, c->name, sizeof(new_cs->name));
|
||||
Cache_Free (c->user, false); //johnfitz -- added second argument
|
||||
new_cs->user->data = (void *)(new_cs+1);
|
||||
}
|
||||
@@ -715,7 +717,7 @@ Looks for a free block of memory between the high and low hunk marks
|
||||
Size should already include the header and padding
|
||||
============
|
||||
*/
|
||||
cache_system_t *Cache_TryAlloc (int size, qboolean nobottom)
|
||||
cache_system_t *Cache_TryAlloc (int size, bool nobottom)
|
||||
{
|
||||
cache_system_t *cs, *new_cs;
|
||||
|
||||
@@ -848,7 +850,7 @@ Cache_Free
|
||||
Frees the memory and removes it from the LRU list
|
||||
==============
|
||||
*/
|
||||
void Cache_Free (cache_user_t *c, qboolean freetextures) //johnfitz -- added second argument
|
||||
void Cache_Free (cache_user_t *c, bool freetextures) //johnfitz -- added second argument
|
||||
{
|
||||
cache_system_t *cs;
|
||||
|
||||
@@ -964,7 +966,6 @@ Memory_Init
|
||||
*/
|
||||
void Memory_Init (void *buf, int size)
|
||||
{
|
||||
int p;
|
||||
int zonesize = DYNAMIC_SIZE;
|
||||
|
||||
hunk_base = (byte *) buf;
|
||||
@@ -973,11 +974,11 @@ void Memory_Init (void *buf, int size)
|
||||
hunk_high_used = 0;
|
||||
|
||||
Cache_Init ();
|
||||
p = COM_CheckParm ("-zone");
|
||||
if (p)
|
||||
auto p = common::check_param ("-zone");
|
||||
if (p.has_value())
|
||||
{
|
||||
if (p < com_argc-1)
|
||||
zonesize = Q_atoi (com_argv[p+1]) * 1024;
|
||||
zonesize = std::atoi (com_argv[p.value()+1]) * 1024;
|
||||
else
|
||||
Sys_Error ("Memory_Init: you must specify a size in KB after -zone");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user