mymemory: make snapshot_{malloc,calloc,free} externally linkable
authorBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 18:05:36 +0000 (11:05 -0700)
committerBrian Norris <banorris@uci.edu>
Wed, 3 Oct 2012 18:05:36 +0000 (11:05 -0700)
As we begin to use these functions, they can't be simply declared
statically in the header; they need to be linkable in hashtable.h, for
instance.

mymemory.cc
mymemory.h

index 6fd7c704b9175c7c47a5df6a50016ded23046a8f..b273608e12586705d8fe10b54b3709a2bfc6bd93 100644 (file)
@@ -68,6 +68,24 @@ void *model_malloc(size_t size) {
 #endif
 }
 
 #endif
 }
 
+/** @brief Snapshotting malloc, for use by model-checker (not user progs) */
+void * snapshot_malloc(size_t size)
+{
+       return malloc(size);
+}
+
+/** @brief Snapshotting calloc, for use by model-checker (not user progs) */
+void * snapshot_calloc(size_t count, size_t size)
+{
+       return calloc(count, size);
+}
+
+/** @brief Snapshotting free, for use by model-checker (not user progs) */
+void snapshot_free(void *ptr)
+{
+       free(ptr);
+}
+
 void *system_malloc( size_t size ){
        static void *(*mallocp)(size_t size);
        char *error;
 void *system_malloc( size_t size ){
        static void *(*mallocp)(size_t size);
        char *error;
index 6b35f5d14f0efb46738d9389c2e8af72c9d3c6a7..c49984ffb62d4aba71f379cdd168a032940c48e5 100644 (file)
@@ -31,15 +31,9 @@ void *model_malloc(size_t size);
 void *model_calloc(size_t count, size_t size);
 void model_free(void *ptr);
 
 void *model_calloc(size_t count, size_t size);
 void model_free(void *ptr);
 
-static inline void * snapshot_malloc(size_t size) {
-       return malloc(size);
-}
-static inline void * snapshot_calloc(size_t count, size_t size) {
-       return calloc(count, size);
-}
-static inline void snapshot_free(void *ptr) {
-       free(ptr);
-}
+void * snapshot_malloc(size_t size);
+void * snapshot_calloc(size_t count, size_t size);
+void snapshot_free(void *ptr);
 
 void system_free( void * ptr );
 void *system_malloc( size_t size );
 
 void system_free( void * ptr );
 void *system_malloc( size_t size );