diff options
author | lloyd <[email protected]> | 2014-01-01 21:20:55 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2014-01-01 21:20:55 +0000 |
commit | 197dc467dec28a04c3b2f30da7cef122dfbb13e9 (patch) | |
tree | cdbd3ddaec051c72f0a757db461973d90c37b97a /src/libstate/global_state.cpp | |
parent | 62faac373c07cfe10bc8c309e89ebdd30d8e5eaa (diff) |
Shuffle things around. Add NIST X.509 test to build.
Diffstat (limited to 'src/libstate/global_state.cpp')
-rw-r--r-- | src/libstate/global_state.cpp | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/src/libstate/global_state.cpp b/src/libstate/global_state.cpp deleted file mode 100644 index 6a846d9b0..000000000 --- a/src/libstate/global_state.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/* -* Global State Management -* (C) 2010 Jack Lloyd -* -* Distributed under the terms of the Botan license -*/ - -#include <botan/global_state.h> -#include <botan/libstate.h> - -namespace Botan { - -/* -* @todo There should probably be a lock to avoid racy manipulation -* of the state among different threads -*/ - -namespace Global_State_Management { - -/* -* Botan's global state -*/ -namespace { - -Library_State* global_lib_state = nullptr; - -} - -/* -* 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(); - } - - return (*global_lib_state); - } - -/* -* Set a new global state object -*/ -void set_global_state(Library_State* new_state) - { - delete swap_global_state(new_state); - } - -/* -* Set a new global state object unless one already existed -*/ -bool set_global_state_unless_set(Library_State* new_state) - { - if(global_lib_state) - { - delete new_state; - return false; - } - else - { - delete swap_global_state(new_state); - return true; - } - } - -/* -* 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; - } - -/* -* Query if library is initialized -*/ -bool global_state_exists() - { - return (global_lib_state != nullptr); - } - -} - -} |