aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-07-02 01:26:46 +0000
committerlloyd <[email protected]>2006-07-02 01:26:46 +0000
commit9fc2248a9689dcb1bc43157e4955347c6fd9c996 (patch)
tree502928fa0c059d743c9fdfb35f245dea801a17a3 /src
parent4a85275067375f0f08f2d281512f6d7174c6ca0e (diff)
Add del_fun and delete2nd functions for running deletes
Use for_each + the delete wrappers in libstate.cpp
Diffstat (limited to 'src')
-rw-r--r--src/libstate.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/libstate.cpp b/src/libstate.cpp
index d59d87be7..cdf4e5009 100644
--- a/src/libstate.cpp
+++ b/src/libstate.cpp
@@ -12,6 +12,7 @@
#include <botan/mutex.h>
#include <botan/timers.h>
#include <botan/charset.h>
+#include <algorithm>
namespace Botan {
@@ -346,16 +347,15 @@ Library_State::~Library_State()
{
delete x509_state_obj;
delete transcoder;
- for(u32bit j = 0; j != entropy_sources.size(); ++j)
- delete entropy_sources[j];
-
delete rng;
delete timer;
- for(u32bit j = 0; j != engines.size(); ++j)
- delete engines[j];
+ std::for_each(entropy_sources.begin(), entropy_sources.end(),
+ del_fun<EntropySource>());
+ std::for_each(engines.begin(), engines.end(), del_fun<Engine>());
cached_default_allocator = 0;
+
for(std::map<std::string, Allocator*>::iterator j = alloc_factory.begin();
j != alloc_factory.end(); ++j)
{
@@ -363,9 +363,8 @@ Library_State::~Library_State()
delete j->second;
}
- for(std::map<std::string, Mutex*>::iterator j = locks.begin();
- j != locks.end(); ++j)
- delete j->second;
+ std::for_each(locks.begin(), locks.end(),
+ delete2nd<std::map<std::string, Mutex*>::value_type>);
delete mutex_factory;
}