From 921d976aa552e5f2a189c594be6111c70e0e5c8a Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Wed, 3 Oct 2012 11:05:36 -0700 Subject: [PATCH] mymemory: make snapshot_{malloc,calloc,free} externally linkable 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 | 18 ++++++++++++++++++ mymemory.h | 12 +++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/mymemory.cc b/mymemory.cc index 6fd7c70..b273608 100644 --- a/mymemory.cc +++ b/mymemory.cc @@ -68,6 +68,24 @@ void *model_malloc(size_t size) { #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; diff --git a/mymemory.h b/mymemory.h index 6b35f5d..c49984f 100644 --- a/mymemory.h +++ b/mymemory.h @@ -31,15 +31,9 @@ void *model_malloc(size_t size); 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 ); -- 2.34.1