Skip to content

Commit 5a5f18d

Browse files
committed
Replace memory functions.
1 parent 0c93fa0 commit 5a5f18d

File tree

7 files changed

+26
-26
lines changed

7 files changed

+26
-26
lines changed

src/Layers/xrRender/DetailManager.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,18 @@ CDetailManager::CDetailManager() : xrc("detail manager")
9696
dm_cache_size = dm_current_cache_size;
9797
dm_fade = dm_current_fade;
9898
ps_r__Detail_density = ps_current_detail_density;
99-
cache_level1 = (CacheSlot1**)Memory.mem_alloc(dm_cache1_line * sizeof(CacheSlot1*));
99+
cache_level1 = (CacheSlot1**)xr_malloc(dm_cache1_line * sizeof(CacheSlot1*));
100100
for (u32 i = 0; i < dm_cache1_line; ++i)
101101
{
102-
cache_level1[i] = (CacheSlot1*)Memory.mem_alloc(dm_cache1_line * sizeof(CacheSlot1));
102+
cache_level1[i] = (CacheSlot1*)xr_malloc(dm_cache1_line * sizeof(CacheSlot1));
103103
for (u32 j = 0; j < dm_cache1_line; ++j)
104104
new(&cache_level1[i][j]) CacheSlot1();
105105
}
106-
cache = (Slot***)Memory.mem_alloc(dm_cache_line * sizeof(Slot**));
106+
cache = (Slot***)xr_malloc(dm_cache_line * sizeof(Slot**));
107107
for (u32 i = 0; i < dm_cache_line; ++i)
108-
cache[i] = (Slot**)Memory.mem_alloc(dm_cache_line * sizeof(Slot*));
108+
cache[i] = (Slot**)xr_malloc(dm_cache_line * sizeof(Slot*));
109109

110-
cache_pool = (Slot *)Memory.mem_alloc(dm_cache_size * sizeof(Slot));
110+
cache_pool = (Slot *)xr_malloc(dm_cache_size * sizeof(Slot));
111111

112112
for (u32 i = 0; i < dm_cache_size; ++i)
113113
new(&cache_pool[i]) Slot();
@@ -124,19 +124,19 @@ CDetailManager::~CDetailManager()
124124
#ifdef DETAIL_RADIUS
125125
for (u32 i = 0; i < dm_cache_size; ++i)
126126
cache_pool[i].~Slot();
127-
Memory.mem_free(cache_pool);
127+
xr_free(cache_pool);
128128

129129
for (u32 i = 0; i < dm_cache_line; ++i)
130-
Memory.mem_free(cache[i]);
131-
Memory.mem_free(cache);
130+
xr_free(cache[i]);
131+
xr_free(cache);
132132

133133
for (u32 i = 0; i < dm_cache1_line; ++i)
134134
{
135135
for (u32 j = 0; j < dm_cache1_line; ++j)
136136
cache_level1[i][j].~CacheSlot1();
137-
Memory.mem_free(cache_level1[i]);
137+
xr_free(cache_level1[i]);
138138
}
139-
Memory.mem_free(cache_level1);
139+
xr_free(cache_level1);
140140
#endif
141141
}
142142
/*

src/utils/xrLC/nv_library/NvTriStripObjects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class NvEdgeInfo
7575
{
7676
if (--m_refCount == 0)
7777
{
78-
Memory.mem_free(this);
78+
delete this;
7979
}
8080
}
8181

src/utils/xrLC_Light/net_stream.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void INetBlockReader::create_block(u32 size)
5555
/*
5656
if( !_buffer )
5757
{
58-
_buffer = (u8*) Memory.mem_alloc ( size
58+
_buffer = (u8*) xr_malloc ( size
5959
#ifdef DEBUG_MEMORY_NAME
6060
, "INetBlockReader - storage"
6161
#endif // DEBUG_MEMORY_NAME
@@ -64,7 +64,7 @@ void INetBlockReader::create_block(u32 size)
6464
}
6565
if( _block_size < size )
6666
{
67-
_buffer = (u8*)Memory.mem_realloc (_buffer,size
67+
_buffer = (u8*)xr_realloc (_buffer,size
6868
#ifdef DEBUG_MEMORY_NAME
6969
, "CMemoryWriter - storage"
7070
#endif // DEBUG_MEMORY_NAME
@@ -80,7 +80,7 @@ INetBlockReader::~INetBlockReader()
8080
{
8181
R_ASSERT(!mem_reader.allocated() || mem_reader.count() == 0);
8282
mem_reader.free_buff();
83-
// Memory.mem_free( _buffer );
83+
// xr_free( _buffer );
8484
}
8585
/*
8686
IC void w_string(const char *p) { w(p,(u32)xr_strlen(p));w_u8(13);w_u8(10); }
@@ -235,7 +235,7 @@ INetFileBuffWriter::INetFileBuffWriter(LPCSTR _file_name, u32 block_size, bool _
235235

236236
INetFileBuffWriter::~INetFileBuffWriter() { xr_delete(mem_writter); }
237237
/*
238-
data = (BYTE*) Memory.mem_realloc (data,mem_size
238+
data = (BYTE*) xr_realloc (data,mem_size
239239
#ifdef DEBUG_MEMORY_NAME
240240
, "CMemoryWriter - storage"
241241
#endif // DEBUG_MEMORY_NAME
@@ -252,7 +252,7 @@ CReadMemoryBlock::CReadMemoryBlock(const u32 buff_size_, u8* buffer)
252252
: buf_size(buff_size_), file_size(0), position(0), _buffer(buffer)
253253
{
254254
/*
255-
data = (u8*) Memory.mem_alloc (file_size_
255+
data = (u8*) xr_malloc (file_size_
256256
#ifdef DEBUG_MEMORY_NAME
257257
, "CReadMemoryBlock - storage"
258258
#endif // DEBUG_MEMORY_NAME
@@ -263,7 +263,7 @@ CReadMemoryBlock::CReadMemoryBlock(const u32 buff_size_, u8* buffer)
263263

264264
CReadMemoryBlock::~CReadMemoryBlock()
265265
{
266-
// Memory.mem_free( data );
266+
// xr_free( data );
267267
}
268268

269269
#include "xrCore/FS_impl.h"

src/utils/xrLC_Light/net_task_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void net_task_manager::create_global_data_write(LPCSTR save_path)
8686

8787
// g_net_data = new CVirtualFileRW(global_data_file_name);
8888

89-
// dbg_buf = Memory.mem_alloc( 560000000, "dbg_buf" );
89+
// dbg_buf = xr_malloc( 560000000, "dbg_buf" );
9090
////////////////
9191
/*{
9292
string_path blfile_name;

src/xrCore/FS.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ bool file_handle_internal(LPCSTR file_name, u32& size, int& file_handle)
122122

123123
void* FileDownload(LPCSTR file_name, const int& file_handle, u32& file_size)
124124
{
125-
void* buffer = Memory.mem_alloc(file_size);
125+
void* buffer = xr_malloc(file_size);
126126

127127
int r_bytes = _read(file_handle, buffer, file_size);
128128
R_ASSERT3(
@@ -199,9 +199,9 @@ void CMemoryWriter::w(const void* ptr, u32 count)
199199
while (mem_size <= (position + count))
200200
mem_size *= 2;
201201
if (0 == data)
202-
data = (BYTE*)Memory.mem_alloc(mem_size);
202+
data = (BYTE*)xr_malloc(mem_size);
203203
else
204-
data = (BYTE*)Memory.mem_realloc(data, mem_size);
204+
data = (BYTE*)xr_realloc(data, mem_size);
205205
}
206206
CopyMemory(data + position, ptr, count);
207207
position += count;

src/xrCore/xrstring.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ str_value* str_container::dock(pcstr value)
180180
#endif // DEBUG
181181
)
182182
{
183-
result = (str_value*)Memory.mem_alloc(sizeof(str_value) + s_len_with_zero);
183+
result = (str_value*)xr_malloc(sizeof(str_value) + s_len_with_zero);
184184

185185
#ifdef DEBUG
186186
static int num_leaked_string = 0;
@@ -325,7 +325,7 @@ str_value* str_container::dock(str_c value)
325325
{
326326
// Insert string
327327
328-
result = (str_value*)Memory.mem_alloc(sizeof(str_value) + s_len_with_zero
328+
result = (str_value*)xr_malloc(sizeof(str_value) + s_len_with_zero
329329
#ifdef DEBUG_MEMORY_NAME
330330
,
331331
"storage: sstring"

src/xrScriptEngine/script_engine.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ static void* lua_alloc(void* ud, void* ptr, size_t osize, size_t nsize)
5050
xr_free(ptr);
5151
return nullptr;
5252
}
53-
return Memory.mem_realloc(ptr, nsize);
53+
return xr_realloc(ptr, nsize);
5454
}
5555

5656
static void* __cdecl luabind_allocator(void* context, const void* pointer, size_t const size)
@@ -63,10 +63,10 @@ static void* __cdecl luabind_allocator(void* context, const void* pointer, size_
6363
}
6464
if (!pointer)
6565
{
66-
return Memory.mem_alloc(size);
66+
return xr_malloc(size);
6767
}
6868
void* non_const_pointer = const_cast<LPVOID>(pointer);
69-
return Memory.mem_realloc(non_const_pointer, size);
69+
return xr_realloc(non_const_pointer, size);
7070
}
7171

7272
namespace

0 commit comments

Comments
 (0)