diff options
Diffstat (limited to 'src/libstate')
-rw-r--r-- | src/libstate/info.txt | 1 | ||||
-rw-r--r-- | src/libstate/libstate.cpp | 72 | ||||
-rw-r--r-- | src/libstate/libstate.h | 19 |
3 files changed, 0 insertions, 92 deletions
diff --git a/src/libstate/info.txt b/src/libstate/info.txt index ef0c9a47e..0e523e601 100644 --- a/src/libstate/info.txt +++ b/src/libstate/info.txt @@ -45,5 +45,4 @@ rng sha2_32 sha2_64 stream -system_alloc </requires> diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp index 588c5db1b..eafa6dbb0 100644 --- a/src/libstate/libstate.cpp +++ b/src/libstate/libstate.cpp @@ -9,7 +9,6 @@ #include <botan/charset.h> #include <botan/engine.h> #include <botan/cpuid.h> -#include <botan/internal/defalloc.h> #include <botan/internal/core_engine.h> #include <botan/internal/stl_util.h> #include <botan/internal/mlock.h> @@ -19,10 +18,6 @@ #include <botan/selftest.h> #endif -#if defined(BOTAN_HAS_ALLOC_MMAP) - #include <botan/internal/mmap_mem.h> -#endif - #if defined(BOTAN_HAS_ENGINE_ASSEMBLER) #include <botan/internal/asm_engine.h> #endif @@ -46,53 +41,6 @@ namespace Botan { /* -* Get an allocator by its name -*/ -Allocator* Library_State::get_allocator(const std::string& type) - { - std::lock_guard<std::mutex> lock(allocator_lock); - - if(type != "") - return search_map<std::string, Allocator*>(alloc_factory, type, 0); - - if(!cached_default_allocator) - { - cached_default_allocator = - search_map<std::string, Allocator*>(alloc_factory, - default_allocator_name, 0); - } - - return cached_default_allocator; - } - -/* -* Create a new name to object mapping -*/ -void Library_State::add_allocator(Allocator* allocator) - { - std::lock_guard<std::mutex> lock(allocator_lock); - - allocator->init(); - - allocators.push_back(allocator); - alloc_factory[allocator->type()] = allocator; - } - -/* -* Set the default allocator type -*/ -void Library_State::set_default_allocator(const std::string& type) - { - if(type == "") - return; - - std::lock_guard<std::mutex> lock(allocator_lock); - - default_allocator_name = type; - cached_default_allocator = 0; - } - -/* * Get a configuration value */ std::string Library_State::get(const std::string& section, @@ -184,16 +132,6 @@ void Library_State::initialize() if(m_algorithm_factory) throw Invalid_State("Library_State has already been initialized"); - cached_default_allocator = 0; - default_allocator_name = has_mlock() ? "locking" : "malloc"; - - add_allocator(new Malloc_Allocator); - add_allocator(new Locking_Allocator); - -#if defined(BOTAN_HAS_ALLOC_MMAP) - add_allocator(new MemoryMapping_Allocator); -#endif - load_default_config(); m_algorithm_factory = new Algorithm_Factory(); @@ -230,7 +168,6 @@ void Library_State::initialize() */ Library_State::Library_State() { - cached_default_allocator = 0; m_algorithm_factory = 0; global_rng_ptr = 0; @@ -246,15 +183,6 @@ Library_State::~Library_State() delete global_rng_ptr; global_rng_ptr = 0; - - - cached_default_allocator = 0; - - for(size_t i = 0; i != allocators.size(); ++i) - { - allocators[i]->destroy(); - delete allocators[i]; - } } } diff --git a/src/libstate/libstate.h b/src/libstate/libstate.h index 49908a1e3..b260a5bb9 100644 --- a/src/libstate/libstate.h +++ b/src/libstate/libstate.h @@ -9,7 +9,6 @@ #define BOTAN_LIB_STATE_H__ #include <botan/global_state.h> -#include <botan/allocate.h> #include <botan/algo_factory.h> #include <botan/rng.h> @@ -45,18 +44,6 @@ class BOTAN_DLL Library_State RandomNumberGenerator& global_rng(); /** - * @param name the name of the allocator - * @return allocator matching this name, or NULL - */ - Allocator* get_allocator(const std::string& name = ""); - - /** - * Add a new allocator to the list of available ones - * @param alloc the allocator to add - */ - void add_allocator(Allocator* alloc); - - /** * Set the default allocator * @param name the name of the allocator to use as the default */ @@ -121,12 +108,6 @@ class BOTAN_DLL Library_State std::mutex config_lock; std::map<std::string, std::string> config; - std::mutex allocator_lock; - std::string default_allocator_name; - std::map<std::string, Allocator*> alloc_factory; - mutable Allocator* cached_default_allocator; - std::vector<Allocator*> allocators; - Algorithm_Factory* m_algorithm_factory; }; |