Browse Source

Get rid of ALLOCFLAGS() macro.

Darryl Pogue 13 years ago committed by Adam Johnson
parent
commit
1fa1197c3e
  1. 1
      Sources/Plasma/CoreLib/hsMalloc.h
  2. 2
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp
  3. 8
      Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.h

1
Sources/Plasma/CoreLib/hsMalloc.h

@ -166,7 +166,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 ZERO(s) MemSet(&s, 0, sizeof(s)) #define ZERO(s) MemSet(&s, 0, sizeof(s))
#define ZEROPTR(p) MemSet(p, 0, sizeof(*p)) #define ZEROPTR(p) MemSet(p, 0, sizeof(*p))

2
Sources/Plasma/NucleusLib/pnUtils/Private/pnUtArray.cpp

@ -95,7 +95,7 @@ unsigned CBaseArray::CalcAllocGrowth (unsigned newAlloc, unsigned oldAlloc, unsi
void * CBaseArray::ReallocPtr (void * ptr, unsigned bytes) { void * CBaseArray::ReallocPtr (void * ptr, unsigned bytes) {
void * newPtr = nil; void * newPtr = nil;
if (bytes) { if (bytes) {
newPtr = ALLOCFLAGS(bytes, ARR_MEMORY_FLAGS); newPtr = malloc(bytes);
} }
return newPtr; return newPtr;
} }

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

@ -67,8 +67,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
#define SORTARRAYTYPE(type) TSortArray< type, TArrayCopyBits< type >, type, 0> #define SORTARRAYTYPE(type) TSortArray< type, TArrayCopyBits< type >, type, 0>
#define SORTARRAYTYPEOBJ(type) TSortArray< type, TArrayCopyObject< type >, type, 0> #define SORTARRAYTYPEOBJ(type) TSortArray< type, TArrayCopyObject< type >, type, 0>
#define ARR_MEMORY_FLAGS 0 /*| kMemIgnoreBlock*/
/**************************************************************************** /****************************************************************************
* *
@ -449,7 +447,7 @@ template<class T, class C>
TFArray<T,C>::TFArray (unsigned count) { TFArray<T,C>::TFArray (unsigned count) {
m_alloc = m_count = count; m_alloc = m_count = count;
if (count) { if (count) {
m_data = (T *)ALLOCFLAGS(count * sizeof(T), ARR_MEMORY_FLAGS); m_data = (T *)malloc(count * sizeof(T));
C::Construct(m_data, count); C::Construct(m_data, count);
} }
else else
@ -461,7 +459,7 @@ template<class T, class C>
TFArray<T,C>::TFArray (const T * source, unsigned count) { TFArray<T,C>::TFArray (const T * source, unsigned count) {
m_alloc = m_count = count; m_alloc = m_count = count;
if (count) { if (count) {
m_data = (T *)ALLOCFLAGS(count * sizeof(T), ARR_MEMORY_FLAGS); m_data = (T *)malloc(count * sizeof(T));
C::CopyConstruct(m_data, source, count); C::CopyConstruct(m_data, source, count);
} }
else else
@ -473,7 +471,7 @@ template<class T, class C>
TFArray<T,C>::TFArray (const TFArray<T,C> & source) { TFArray<T,C>::TFArray (const TFArray<T,C> & source) {
m_alloc = m_count = source.m_count; m_alloc = m_count = source.m_count;
if (m_count) { if (m_count) {
m_data = (T *)ALLOCFLAGS(m_count * sizeof(T), ARR_MEMORY_FLAGS); m_data = (T *)malloc(m_count * sizeof(T));
C::CopyConstruct(m_data, source.m_data, m_count); C::CopyConstruct(m_data, source.m_data, m_count);
} }
else else

Loading…
Cancel
Save