diff options
author | lloyd <[email protected]> | 2010-08-06 15:38:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-08-06 15:38:55 +0000 |
commit | 22718fa6526bf5c9923d0091d662cd2def75c605 (patch) | |
tree | 74136557e7b945ed3a5ee64e980613c3325f633e /src/libstate/libstate.cpp | |
parent | 5d9eecf1646facfff9b20e9932894fce0d0ff39c (diff) |
Move the functions that directly manipulate the global state singleton
into global_state.{h,cpp}. Move all of the functions into a new
namespace Global_State_Management, though exposing global_state() into
the Botan namespace for compatability.
Also add new functions global_state_exists and
set_global_state_unless_set which may be helpful in certain tricky
initialization scenarios (eg when an application using botan also uses
a library which may or may not itself use botan).
Diffstat (limited to 'src/libstate/libstate.cpp')
-rw-r--r-- | src/libstate/libstate.cpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/libstate/libstate.cpp b/src/libstate/libstate.cpp index 8d8634bab..a20fc76c6 100644 --- a/src/libstate/libstate.cpp +++ b/src/libstate/libstate.cpp @@ -56,50 +56,6 @@ namespace Botan { /* -* Botan's global state -*/ -namespace { - -Library_State* global_lib_state = 0; - -} - -/* -* Access the global state object -*/ -Library_State& global_state() - { - /* Lazy initialization. Botan still needs to be deinitialized later - on or memory might leak. - */ - if(!global_lib_state) - { - global_lib_state = new Library_State; - global_lib_state->initialize(true); - } - - return (*global_lib_state); - } - -/* -* Set a new global state object -*/ -void set_global_state(Library_State* new_state) - { - delete swap_global_state(new_state); - } - -/* -* Swap two global state objects -*/ -Library_State* swap_global_state(Library_State* new_state) - { - Library_State* old_state = global_lib_state; - global_lib_state = new_state; - return old_state; - } - -/* * Get a new mutex object */ Mutex* Library_State::get_mutex() const |