aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstate
diff options
context:
space:
mode:
authorlloyd <[email protected]>2009-09-11 19:26:44 +0000
committerlloyd <[email protected]>2009-09-11 19:26:44 +0000
commitcc8b60c7f5ea6be28848498367645cbccba035e8 (patch)
treee6586d17d8b136c3e55eb02ddf504d34b193bbb2 /src/libstate
parentaa7beddcc30d256dbcaea55a951ca75c5361b2b4 (diff)
Remove dep on mutex module (doesn't exist here). Use initializer list in libstate.cpp
Diffstat (limited to 'src/libstate')
-rw-r--r--src/libstate/info.txt2
-rw-r--r--src/libstate/libstate.cpp22
2 files changed, 11 insertions, 13 deletions
diff --git a/src/libstate/info.txt b/src/libstate/info.txt
index 6eaa2f70b..fcf386e6d 100644
--- a/src/libstate/info.txt
+++ b/src/libstate/info.txt
@@ -34,8 +34,6 @@ hash
kdf
mac
mode_pad
-mutex
-noop_mutex
pk_pad
pubkey
rng
diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp
index 839d71d60..676c2a949 100644
--- a/src/libstate/libstate.cpp
+++ b/src/libstate/libstate.cpp
@@ -9,7 +9,6 @@
#include <botan/init.h>
#include <botan/engine.h>
#include <botan/stl_util.h>
-#include <botan/mux_noop.h>
#include <botan/charset.h>
#include <botan/defalloc.h>
#include <botan/def_eng.h>
@@ -77,7 +76,7 @@ void set_global_state(Library_State* new_state)
*/
Library_State* swap_global_state(Library_State* new_state)
{
- Library_State* old_state = global_lib_state;
+ auto old_state = global_lib_state;
global_lib_state = new_state;
return old_state;
}
@@ -124,11 +123,11 @@ void Library_State::add_allocator(Allocator* allocator)
*/
void Library_State::set_default_allocator(const std::string& type)
{
- std::lock_guard<std::mutex> lock(allocator_lock);
-
if(type == "")
return;
+ std::lock_guard<std::mutex> lock(allocator_lock);
+
this->set("conf", "base/default_allocator", type);
cached_default_allocator = 0;
}
@@ -240,29 +239,30 @@ void Library_State::initialize()
load_default_config();
- std::vector<Engine*> engines;
+ std::vector<Engine*> engines = {
#if defined(BOTAN_HAS_ENGINE_GNU_MP)
- engines.push_back(new GMP_Engine);
+ new GMP_Engine,
#endif
#if defined(BOTAN_HAS_ENGINE_OPENSSL)
- engines.push_back(new OpenSSL_Engine);
+ new OpenSSL_Engine,
#endif
#if defined(BOTAN_HAS_ENGINE_SSE2_ASSEMBLER)
- engines.push_back(new SSE2_Assembler_Engine);
+ new SSE2_Assembler_Engine,
#endif
#if defined(BOTAN_HAS_ENGINE_AMD64_ASSEMBLER)
- engines.push_back(new AMD64_Assembler_Engine);
+ new AMD64_Assembler_Engine,
#endif
#if defined(BOTAN_HAS_ENGINE_IA32_ASSEMBLER)
- engines.push_back(new IA32_Assembler_Engine);
+ new IA32_Assembler_Engine,
#endif
- engines.push_back(new Default_Engine);
+ new Default_Engine
+ };
m_algorithm_factory = new Algorithm_Factory(engines);
}