Browse Source

HSMemory::SoftNew is unused, and can be done with pure standard C++ anyway

Michael Hansen 9 years ago
parent
commit
847c64eeab
  1. 38
      Sources/Plasma/CoreLib/hsMemory.cpp
  2. 2
      Sources/Plasma/CoreLib/hsMemory.h

38
Sources/Plasma/CoreLib/hsMemory.cpp

@ -110,44 +110,6 @@ void HSMemory::Clear(void* m, uint32_t byteLen)
//////////////////////////////////////////////////////////////////////////////////////
#if 0
template <class T> T* hsSoftNew(T*& obj)
{
try {
obj = new T;
}
catch (...) {
obj = nil;
}
return obj;
}
inline template <class T> T* hsSoftNew(T*& obj, unsigned count)
{
try {
obj = new T[count];
}
catch (...) {
obj = nil;
}
return obj;
}
#endif
void* HSMemory::SoftNew(uint32_t size)
{
uint32_t* p;
hsTry {
p = new uint32_t[(size + 3) >> 2];
} hsCatch(...) {
p = nil;
}
return p;
}
//////////////////////////////////////////////////////////////////////////////////////
struct hsPrivateChunk {
hsPrivateChunk* fNext;
char* fAvailableAddr;

2
Sources/Plasma/CoreLib/hsMemory.h

@ -56,8 +56,6 @@ public:
static void* New(uint32_t size);
static void Delete(void* block);
static void* Copy(uint32_t length, const void* source);
static void* SoftNew(uint32_t size); // returns nil if can't allocate
};
///////////////////////////////////////////////////////////////////////////////////////////

Loading…
Cancel
Save