mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2025-01-28 06:38:06 +03:00
Merge pull request #261 from Arkshine/feature/datapack-memory
Improve DataPack memory allocation
This commit is contained in:
commit
b8dd9d19dd
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
#include "CDataPack.h"
|
#include "CDataPack.h"
|
||||||
|
|
||||||
#define DATAPACK_INITIAL_SIZE 512
|
#define DATAPACK_INITIAL_SIZE 64
|
||||||
|
|
||||||
CDataPack::CDataPack()
|
CDataPack::CDataPack()
|
||||||
{
|
{
|
||||||
@ -60,9 +60,10 @@ void CDataPack::CheckSize(size_t typesize)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
m_capacity *= 2;
|
m_capacity *= 2;
|
||||||
m_pBase = (char *)realloc(m_pBase, m_capacity);
|
} while (pos + typesize > m_capacity);
|
||||||
m_curptr = m_pBase + pos;
|
|
||||||
} while (m_curptr - m_pBase + typesize > m_capacity);
|
m_pBase = (char *)realloc(m_pBase, m_capacity);
|
||||||
|
m_curptr = m_pBase + pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CDataPack::ResetSize()
|
void CDataPack::ResetSize()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user