fix disable inline build

This commit is contained in:
Jacob Barthelmeh
2016-03-28 14:24:12 -06:00
parent 137f477277
commit 79a212da8d

View File

@@ -52,7 +52,19 @@
static memoryStats ourMemStats; static memoryStats ourMemStats;
#endif #endif
static INLINE void* TrackMalloc(size_t sz) /* if defined to not using inline then declare function prototypes */
#ifdef NO_INLINE
#define STATIC
WOLFSSL_LOCAL void* TrackMalloc(size_t sz);
WOLFSSL_LOCAL void TrackFree(void* ptr);
WOLFSSL_LOCAL void* TrackRealloc(void* ptr, size_t sz);
WOLFSSL_LOCAL int InitMemoryTracker(void);
WOLFSSL_LOCAL void ShowMemoryTracker(void);
#else
#define STATIC static
#endif
STATIC INLINE void* TrackMalloc(size_t sz)
{ {
memoryTrack* mt; memoryTrack* mt;
@@ -78,7 +90,7 @@
} }
static INLINE void TrackFree(void* ptr) STATIC INLINE void TrackFree(void* ptr)
{ {
memoryTrack* mt; memoryTrack* mt;
@@ -97,7 +109,7 @@
} }
static INLINE void* TrackRealloc(void* ptr, size_t sz) STATIC INLINE void* TrackRealloc(void* ptr, size_t sz)
{ {
void* ret = TrackMalloc(sz); void* ret = TrackMalloc(sz);
@@ -119,7 +131,7 @@
return ret; return ret;
} }
static INLINE int InitMemoryTracker(void) STATIC INLINE int InitMemoryTracker(void)
{ {
int ret = wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc); int ret = wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc);
if (ret < 0) { if (ret < 0) {
@@ -133,11 +145,11 @@
ourMemStats.peakBytes = 0; ourMemStats.peakBytes = 0;
ourMemStats.currentBytes = 0; ourMemStats.currentBytes = 0;
#endif #endif
return ret; return ret;
} }
static INLINE void ShowMemoryTracker(void) STATIC INLINE void ShowMemoryTracker(void)
{ {
#ifdef DO_MEM_STATS #ifdef DO_MEM_STATS
printf("total Allocs = %9lu\n", printf("total Allocs = %9lu\n",
@@ -154,4 +166,4 @@
#endif /* USE_WOLFSSL_MEMORY */ #endif /* USE_WOLFSSL_MEMORY */
#endif /* WOLFSSL_MEM_TRACK_H */ #endif /* WOLFSSL_MEM_TRACK_H */