Browse Source

engine: common: zone: use stdint types

pull/2/head
Alibek Omarov 2 years ago
parent
commit
171c0c8d3b
  1. 16
      engine/common/zone.c

16
engine/common/zone.c

@ -15,8 +15,8 @@ GNU General Public License for more details. @@ -15,8 +15,8 @@ GNU General Public License for more details.
#include "common.h"
#define MEMHEADER_SENTINEL1 0xDEADF00D
#define MEMHEADER_SENTINEL2 0xDF
#define MEMHEADER_SENTINEL1 0xDEADF00DU
#define MEMHEADER_SENTINEL2 0xDFU
#ifdef XASH_CUSTOM_SWAP
#include "platform/swap/swap.h"
@ -34,18 +34,18 @@ typedef struct memheader_s @@ -34,18 +34,18 @@ typedef struct memheader_s
struct mempool_s *pool; // pool this memheader belongs to
size_t size; // size of the memory after the header (excluding header and sentinel2)
const char *filename; // file name and line where Mem_Alloc was called
uint fileline;
int fileline;
#if !XASH_64BIT
uint pad0; // doesn't have value, only to make Mem_Alloc return aligned addresses on ILP32
uint32_t pad0; // doesn't have value, only to make Mem_Alloc return aligned addresses on ILP32
#endif
uint sentinel1; // should always be MEMHEADER_SENTINEL1
uint32_t sentinel1; // should always be MEMHEADER_SENTINEL1
// immediately followed by data, which is followed by a MEMHEADER_SENTINEL2 byte
} memheader_t;
typedef struct mempool_s
{
uint sentinel1; // should always be MEMHEADER_SENTINEL1
uint32_t sentinel1; // should always be MEMHEADER_SENTINEL1
struct memheader_s *chain; // chain of individual memory allocations
size_t totalsize; // total memory allocated in this pool (inside memheaders)
size_t realsize; // total memory allocated in this pool (actual malloc total)
@ -57,7 +57,7 @@ typedef struct mempool_s @@ -57,7 +57,7 @@ typedef struct mempool_s
poolhandle_t idx;
#endif
char name[64]; // name of the pool
uint sentinel2; // should always be MEMHEADER_SENTINEL1
uint32_t sentinel2; // should always be MEMHEADER_SENTINEL1
} mempool_t;
static mempool_t *poolchain = NULL; // critical stuff
@ -67,7 +67,7 @@ static mempool_t *poolchain = NULL; // critical stuff @@ -67,7 +67,7 @@ static mempool_t *poolchain = NULL; // critical stuff
// which makes engine incompatible with 64-bit pointers I changed mempool type
// from pointer to 32-bit handle, thankfully mempool structure is private
// But! Mempools are handled through linked list so we can't index them safely
static uint lastidx = 0;
static poolhandle_t lastidx = 0;
static mempool_t *Mem_FindPool( poolhandle_t poolptr )
{

Loading…
Cancel
Save