Browse Source

Get rid of FREEFLAGS() which ignored the flags >.>

Darryl Pogue 13 years ago committed by Adam Johnson
parent
commit
48b8cd8ad0
  1. 1
      Sources/Plasma/CoreLib/hsMalloc.h
  2. 16
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h

1
Sources/Plasma/CoreLib/hsMalloc.h

@ -167,7 +167,6 @@ inline void CDECL operator delete (void *, void *) {}
#define ALLOC(b) MemAlloc(b, 0, __FILE__, __LINE__) #define ALLOC(b) MemAlloc(b, 0, __FILE__, __LINE__)
#define ALLOCZERO(b) MemAlloc(b, kMemZero, __FILE__, __LINE__) #define ALLOCZERO(b) MemAlloc(b, kMemZero, __FILE__, __LINE__)
#define ALLOCFLAGS(b, f) MemAlloc(b, (f), __FILE__, __LINE__) #define ALLOCFLAGS(b, f) MemAlloc(b, (f), __FILE__, __LINE__)
#define FREEFLAGS(p, f) MemFree(p, (f))
#define REALLOC(p, b) MemRealloc(p, b, 0, __FILE__, __LINE__) #define REALLOC(p, b) MemRealloc(p, b, 0, __FILE__, __LINE__)
#define REALLOCFLAGS(p, b, f) MemRealloc(p, b, (f), __FILE__, __LINE__) #define REALLOCFLAGS(p, b, f) MemRealloc(p, b, (f), __FILE__, __LINE__)
#define CALLOC(n, s) MemAlloc((n)*(s), kMemZero, __FILE__, __LINE__) #define CALLOC(n, s) MemAlloc((n)*(s), kMemZero, __FILE__, __LINE__)

16
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h

@ -142,7 +142,7 @@ TBuffer<T>::TBuffer (const TBuffer<T> & source) {
template<class T> template<class T>
TBuffer<T>::~TBuffer () { TBuffer<T>::~TBuffer () {
if (m_data) if (m_data)
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
} }
//=========================================================================== //===========================================================================
@ -181,7 +181,7 @@ T TBuffer<T>::operator[] (unsigned index) const {
template<class T> template<class T>
void TBuffer<T>::Attach (T * source, unsigned count) { void TBuffer<T>::Attach (T * source, unsigned count) {
if (m_data) if (m_data)
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
m_data = source; m_data = source;
ASSERT(MemSize(source) >= count * sizeof(T)); ASSERT(MemSize(source) >= count * sizeof(T));
} }
@ -196,7 +196,7 @@ unsigned TBuffer<T>::Bytes () const {
template<class T> template<class T>
void TBuffer<T>::Clear () { void TBuffer<T>::Clear () {
if (m_data) { if (m_data) {
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
m_data = nil; m_data = nil;
} }
} }
@ -247,7 +247,7 @@ void TBuffer<T>::SetBytes (unsigned bytes) {
if (bytes) if (bytes)
m_data = (T *)REALLOCFLAGS(m_data, bytes, ARR_MEMORY_FLAGS); m_data = (T *)REALLOCFLAGS(m_data, bytes, ARR_MEMORY_FLAGS);
else if (m_data) { else if (m_data) {
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
m_data = nil; m_data = nil;
} }
} }
@ -539,7 +539,7 @@ void TFArray<T,C>::AdjustSize (unsigned newAlloc, unsigned newCount) {
C::CopyConstruct(newData, m_data, m_count); C::CopyConstruct(newData, m_data, m_count);
C::Destruct(m_data, m_count); C::Destruct(m_data, m_count);
if (m_data) if (m_data)
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
} }
m_alloc = newAlloc; m_alloc = newAlloc;
m_data = newData; m_data = newData;
@ -558,7 +558,7 @@ template<class T, class C>
void TFArray<T,C>::Attach (T * source, unsigned count) { void TFArray<T,C>::Attach (T * source, unsigned count) {
C::Destruct(m_data, m_count); C::Destruct(m_data, m_count);
if (m_data) if (m_data)
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
m_data = source; m_data = source;
m_alloc = MemSize(source) / sizeof(T); m_alloc = MemSize(source) / sizeof(T);
m_count = count; m_count = count;
@ -570,7 +570,7 @@ template<class T, class C>
void TFArray<T,C>::AttachTemp (T * source, unsigned count) { void TFArray<T,C>::AttachTemp (T * source, unsigned count) {
C::Destruct(m_data, m_count); C::Destruct(m_data, m_count);
if (m_data) if (m_data)
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
m_data = source; m_data = source;
m_alloc = count; m_alloc = count;
m_count = count; m_count = count;
@ -587,7 +587,7 @@ template<class T, class C>
void TFArray<T,C>::Clear () { void TFArray<T,C>::Clear () {
C::Destruct(m_data, m_count); C::Destruct(m_data, m_count);
if (m_data) if (m_data)
FREEFLAGS(m_data, ARR_MEMORY_FLAGS); free(m_data);
m_data = nil; m_data = nil;
m_alloc = m_count = 0; m_alloc = m_count = 0;
} }

Loading…
Cancel
Save