aboutsummaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-09-29 02:25:45 +0000
committerlloyd <[email protected]>2008-09-29 02:25:45 +0000
commitbd27a130b13667feb26f3157d67d21f8ddb5986e (patch)
treeb01a547f8faf911632a90701079bd1c4f41385d6 /src/core
parent45bde591db0feeb274e137aa021495f823409fd4 (diff)
Pass a Mutex* as an argument to Pooling_Allocator instead of it grabbing
one via a reference to the global state.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/libstate.cpp2
-rw-r--r--src/core/modules.cpp6
-rw-r--r--src/core/modules.h7
3 files changed, 9 insertions, 6 deletions
diff --git a/src/core/libstate.cpp b/src/core/libstate.cpp
index df9d2b519..60bb24fee 100644
--- a/src/core/libstate.cpp
+++ b/src/core/libstate.cpp
@@ -239,7 +239,7 @@ void Library_State::initialize(const InitializerOptions& args,
cached_default_allocator = 0;
- std::vector<Allocator*> mod_allocs = modules.allocators();
+ std::vector<Allocator*> mod_allocs = modules.allocators(mutex_factory);
for(u32bit j = 0; j != mod_allocs.size(); ++j)
add_allocator(mod_allocs[j]);
diff --git a/src/core/modules.cpp b/src/core/modules.cpp
index 08ab0cdbb..08553bf00 100644
--- a/src/core/modules.cpp
+++ b/src/core/modules.cpp
@@ -61,15 +61,15 @@ Mutex_Factory* Builtin_Modules::mutex_factory(bool thread_safe) const
/*************************************************
* Find any usable allocators *
*************************************************/
-std::vector<Allocator*> Builtin_Modules::allocators() const
+std::vector<Allocator*> Builtin_Modules::allocators(Mutex_Factory* mf) const
{
std::vector<Allocator*> allocators;
#if defined(BOTAN_HAS_ALLOC_MMAP)
- allocators.push_back(new MemoryMapping_Allocator);
+ allocators.push_back(new MemoryMapping_Allocator(mf->make()));
#endif
- allocators.push_back(new Locking_Allocator);
+ allocators.push_back(new Locking_Allocator(mf->make()));
allocators.push_back(new Malloc_Allocator);
return allocators;
diff --git a/src/core/modules.h b/src/core/modules.h
index 69a6e1ffb..abbfbb2c6 100644
--- a/src/core/modules.h
+++ b/src/core/modules.h
@@ -7,6 +7,7 @@
#define BOTAN_MODULE_FACTORIES_H__
#include <botan/init.h>
+#include <botan/mutex.h>
#include <string>
#include <vector>
@@ -22,7 +23,9 @@ class BOTAN_DLL Modules
virtual std::string default_allocator() const = 0;
- virtual std::vector<class Allocator*> allocators() const = 0;
+ virtual std::vector<class Allocator*>
+ allocators(Mutex_Factory*) const = 0;
+
virtual std::vector<class Engine*> engines() const = 0;
virtual ~Modules() {}
@@ -38,7 +41,7 @@ class BOTAN_DLL Builtin_Modules : public Modules
std::string default_allocator() const;
- std::vector<class Allocator*> allocators() const;
+ std::vector<class Allocator*> allocators(Mutex_Factory*) const;
std::vector<class Engine*> engines() const;
Builtin_Modules(const InitializerOptions&);