aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine/gnump/gmp_mem.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2008-11-09 19:49:23 +0000
committerlloyd <[email protected]>2008-11-09 19:49:23 +0000
commitcec305c17354fca9c426d76a78f7088f60607afb (patch)
tree1bf7b53a76617339d67523d34be34f903ced28fc /src/engine/gnump/gmp_mem.cpp
parentb01c1d79f02de8ca5c02f08e73cedeadc4d0753a (diff)
Move engine to libstate/ directory, since there is a mutual dependency
(messy). Remove unused libstate.h includes from a few files.
Diffstat (limited to 'src/engine/gnump/gmp_mem.cpp')
-rw-r--r--src/engine/gnump/gmp_mem.cpp68
1 files changed, 0 insertions, 68 deletions
diff --git a/src/engine/gnump/gmp_mem.cpp b/src/engine/gnump/gmp_mem.cpp
deleted file mode 100644
index 91ba94dd7..000000000
--- a/src/engine/gnump/gmp_mem.cpp
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************
-* GNU MP Memory Handlers Source File *
-* (C) 1999-2007 Jack Lloyd *
-*************************************************/
-
-#include <botan/eng_gmp.h>
-#include <cstring>
-#include <gmp.h>
-
-namespace Botan {
-
-namespace {
-
-/*************************************************
-* Allocator used by GNU MP *
-*************************************************/
-Allocator* gmp_alloc = 0;
-
-/*************************************************
-* Allocation Function for GNU MP *
-*************************************************/
-void* gmp_malloc(size_t n)
- {
- return gmp_alloc->allocate(n);
- }
-
-/*************************************************
-* Reallocation Function for GNU MP *
-*************************************************/
-void* gmp_realloc(void* ptr, size_t old_n, size_t new_n)
- {
- void* new_buf = gmp_alloc->allocate(new_n);
- std::memcpy(new_buf, ptr, std::min(old_n, new_n));
- gmp_alloc->deallocate(ptr, old_n);
- return new_buf;
- }
-
-/*************************************************
-* Deallocation Function for GNU MP *
-*************************************************/
-void gmp_free(void* ptr, size_t n)
- {
- gmp_alloc->deallocate(ptr, n);
- }
-
-}
-
-/*************************************************
-* Set the GNU MP memory functions *
-*************************************************/
-void GMP_Engine::set_memory_hooks()
- {
- if(gmp_alloc == 0)
- {
- gmp_alloc = Allocator::get(true);
- mp_set_memory_functions(gmp_malloc, gmp_realloc, gmp_free);
- }
- }
-
-/*************************************************
-* GMP_Engine Constructor *
-*************************************************/
-GMP_Engine::GMP_Engine()
- {
- set_memory_hooks();
- }
-
-}