diff options
author | lloyd <[email protected]> | 2008-09-14 03:42:03 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2008-09-14 03:42:03 +0000 |
commit | de02c2fe44ad7ce5ead3967c22aa689da508eaa0 (patch) | |
tree | 9796295c7c69c432417de271d9877ef2c5c4bd97 | |
parent | fc2fbc643aa77f25761cd2f51362c024267c321e (diff) |
The Memory_Exhaustion exception was only thrown from mem_pool.cpp, so
move in there. Make it a subclass of std::bad_alloc instead of
Botan::Exception (this may prove to be a design mistake).
-rw-r--r-- | include/exceptn.h | 9 | ||||
-rw-r--r-- | src/mem_pool.cpp | 14 |
2 files changed, 14 insertions, 9 deletions
diff --git a/include/exceptn.h b/include/exceptn.h index 7bf486fa7..3bfec2fd2 100644 --- a/include/exceptn.h +++ b/include/exceptn.h @@ -190,15 +190,6 @@ struct BOTAN_DLL Self_Test_Failure : public Internal_Error Internal_Error("Self test failed: " + err) {} }; -/************************************************* -* Memory Allocation Exception * -*************************************************/ -struct BOTAN_DLL Memory_Exhaustion : public Exception - { - Memory_Exhaustion() : - Exception("Ran out of memory, allocation failed") {} - }; - } #endif diff --git a/src/mem_pool.cpp b/src/mem_pool.cpp index 4c2c30d25..74d09d5df 100644 --- a/src/mem_pool.cpp +++ b/src/mem_pool.cpp @@ -9,9 +9,23 @@ #include <botan/libstate.h> #include <botan/util.h> #include <algorithm> +#include <exception> namespace Botan { +namespace { + +/************************************************* +* Memory Allocation Exception * +*************************************************/ +struct Memory_Exhaustion : public std::bad_alloc + { + const char* what() + { return "Ran out of memory, allocation failed"; } + }; + +} + /************************************************* * Memory_Block Constructor * *************************************************/ |