mymemory: implement snapshot_*() allocations on model-checker's heap
[c11tester.git] / mymemory.h
index 87ee0e92b5bc863b344302a8ea6888571b21be76..d7c4f99599ac785f9abdb9845c00bc563db0b747 100644 (file)
@@ -7,6 +7,8 @@
 #include <stdlib.h>
 #include <limits>
 
+#include "config.h"
+
 /** MEMALLOC declares the allocators for a class to allocate
  *     memory in the non-snapshotting heap. */
 #define MEMALLOC \
@@ -45,11 +47,9 @@ void model_free(void *ptr);
 
 void * snapshot_malloc(size_t size);
 void * snapshot_calloc(size_t count, size_t size);
+void * snapshot_realloc(void *ptr, size_t size);
 void snapshot_free(void *ptr);
 
-void system_free( void * ptr );
-void *system_malloc( size_t size );
-
 /** @brief Provides a non-snapshotting allocator for use in STL classes.
  *
  * The code was adapted from a code example from the book The C++
@@ -130,7 +130,7 @@ class ModelAlloc {
 
 /** Return that all specializations of this allocator are interchangeable. */
 template <class T1, class T2>
-bool operator== (const ModelAlloc<T1>&,
+bool operator ==(const ModelAlloc<T1>&,
                const ModelAlloc<T2>&) throw() {
        return true;
 }
@@ -152,8 +152,13 @@ extern void* mspace_realloc(mspace msp, void* mem, size_t newsize);
 extern void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size);
 extern mspace create_mspace_with_base(void* base, size_t capacity, int locked);
 extern mspace create_mspace(size_t capacity, int locked);
-extern mspace mySpace;
-extern void * basemySpace;
+
+#if USE_MPROTECT_SNAPSHOT
+extern mspace user_snapshot_space;
+#endif
+
+extern mspace model_snapshot_space;
+
 #ifdef __cplusplus
 };  /* end of extern "C" */
 #endif