From a1d563c9204b50aad4a97756e8356439a6f0b64b Mon Sep 17 00:00:00 2001 From: Michael Hansen Date: Sun, 2 Aug 2015 19:59:07 -0700 Subject: [PATCH] Remove HS_NO_EXCEPTIONS support. It wasn't true anyway. --- Sources/Plasma/CoreLib/hsExceptions.h | 56 +-------------------------- Sources/Plasma/CoreLib/hsMemory.cpp | 13 ------- Sources/Plasma/CoreLib/hsMemory.h | 3 +- 3 files changed, 2 insertions(+), 70 deletions(-) diff --git a/Sources/Plasma/CoreLib/hsExceptions.h b/Sources/Plasma/CoreLib/hsExceptions.h index 134afdce..0265ecc0 100644 --- a/Sources/Plasma/CoreLib/hsExceptions.h +++ b/Sources/Plasma/CoreLib/hsExceptions.h @@ -45,11 +45,6 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com #include "HeadSpin.h" #include -// #define HS_NO_EXCEPTIONS -- this will turn off execptions you might want -// to do it with -D or equivalent instead of here since who knows who includes this. - - - enum hsErrorEnum { kNo_hsError, kNilParam_hsError, @@ -94,12 +89,7 @@ public: ///////////////////////////////////////////////////////////////////////////////// -#ifndef HS_NO_EXCEPTIONS -#define hsThrow(a) {hsAssert(0,#a);throw a;} -#define hsCatch(a) catch (a) -#define hsCatch2(a,b) catch (a b) - -#define hsTry try +#define hsThrow(a) { hsAssert(0,#a); throw a; } inline void hsThrowIfNilParam(const void* p) { @@ -164,48 +154,4 @@ inline void hsThrowIfFalse(bool condition, const char message[]) } } -#else -#define hsThrow(a) {hsAssert(0,#a);} -#define hsCatch(a) if(0) -#define hsCatch2(a,b) if(0) -#define hsTry - -inline void hsThrowIfNilParam(const void* p) -{ - hsAssert(p!=nil,"hsThrowIfNilParam"); -} - -inline void hsThrowIfBadParam(bool trueIfBadParam) -{ - hsAssert(!trueIfBadParam,"hsThrowIfBadParam"); -} - -inline void hsThrowIfOSErr(long osErr) -{ - hsAssert(osErr==0,"hsThrowIfOSErr"); -} - -inline void hsThrowIfTrue(bool condition) -{ - hsAssert(!condition,"hsThrowIfTrue"); -} - -inline void hsThrowIfFalse(bool condition) -{ - hsAssert(condition,"hsThrowIfFalse"); -} - -inline void hsThrowIfTrue(bool condition, const char message[]) -{ - hsAssert(!condition,message); -} - -inline void hsThrowIfFalse(bool condition, const char message[]) -{ - hsAssert(condition,message); -} - - -#endif - #endif diff --git a/Sources/Plasma/CoreLib/hsMemory.cpp b/Sources/Plasma/CoreLib/hsMemory.cpp index e73946b8..fdd18685 100644 --- a/Sources/Plasma/CoreLib/hsMemory.cpp +++ b/Sources/Plasma/CoreLib/hsMemory.cpp @@ -184,19 +184,6 @@ void* hsChunkAllocator::Allocate(uint32_t size, const void* data) return addr; } -void* hsChunkAllocator::SoftAllocate(uint32_t size, const void* data) -{ - void* addr; - - hsTry { - addr = this->Allocate(size, data); - } - hsCatch(...) { - addr = nil; - } - return addr; -} - ////////////////////////////////////////////////////////////////////////////////////// struct hsAppenderHead { diff --git a/Sources/Plasma/CoreLib/hsMemory.h b/Sources/Plasma/CoreLib/hsMemory.h index ab2a169b..0b5d8c5e 100644 --- a/Sources/Plasma/CoreLib/hsMemory.h +++ b/Sources/Plasma/CoreLib/hsMemory.h @@ -108,8 +108,7 @@ public: void Reset(); void SetChunkSize(uint32_t size); - void* Allocate(uint32_t size, const void* data = nil); // throws if fails - void* SoftAllocate(uint32_t size, const void* data = nil); // returns nil if fails + void* Allocate(uint32_t size, const void* data = nil); }; ///////////////////////////////////////////////////////////////////////////////////////////