aboutsummaryrefslogtreecommitdiffstats
path: root/src/mem_pool.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-14 03:42:03 +0000
committerlloyd <[email protected]>2008-09-14 03:42:03 +0000
commitde02c2fe44ad7ce5ead3967c22aa689da508eaa0 (patch)
tree9796295c7c69c432417de271d9877ef2c5c4bd97 /src/mem_pool.cpp
parentfc2fbc643aa77f25761cd2f51362c024267c321e (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).
Diffstat (limited to 'src/mem_pool.cpp')
-rw-r--r--src/mem_pool.cpp14
1 files changed, 14 insertions, 0 deletions
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 *
*************************************************/