diff options
Diffstat (limited to 'src/core/templates.h')
-rw-r--r-- | src/core/templates.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/templates.h b/src/core/templates.h index f785d647..a1627357 100644 --- a/src/core/templates.h +++ b/src/core/templates.h @@ -61,12 +61,21 @@ public: T *New(void){ bool wrapped = false; do +#ifdef FIX_BUGS + if (++m_allocPtr >= m_size) { + m_allocPtr = 0; + if (wrapped) + return nil; + wrapped = true; + } +#else if(++m_allocPtr == m_size){ if(wrapped) return nil; wrapped = true; m_allocPtr = 0; } +#endif while(!m_flags[m_allocPtr].free); m_flags[m_allocPtr].free = 0; m_flags[m_allocPtr].id++; |