[c] Fixed KMemory and test harness for GCC on Linux.

This commit is contained in:
badlogic 2017-10-06 15:22:49 +02:00
parent 5cd07084b0
commit 3dbab2122d
2 changed files with 7 additions and 7 deletions

View File

@ -22,11 +22,11 @@ void RegisterMemoryLeakDetector()
{ {
// Register our malloc and free functions to track memory leaks // Register our malloc and free functions to track memory leaks
#ifdef KANJI_MEMTRACE #ifdef KANJI_MEMTRACE
_setDebugMalloc(_kanjimalloc); _spSetDebugMalloc(_kanjimalloc);
#endif #endif
_setMalloc(_kanjimalloc); _spSetMalloc(_kanjimalloc);
_setRealloc(_kanjirealloc); _spSetRealloc(_kanjirealloc);
_setFree(_kanjifree); _spSetFree(_kanjifree);
} }
int main(int argc, char* argv[]) int main(int argc, char* argv[])
@ -74,6 +74,6 @@ extern "C" { // probably unnecessary
} }
char* _spUtil_readFile(const char* path, int* length) { char* _spUtil_readFile(const char* path, int* length) {
return _readFile(path, length); return _spReadFile(path, length);
} }
} }

View File

@ -30,7 +30,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Our memory system is thread-safe, but instead of linking massive libraries, // Our memory system is thread-safe, but instead of linking massive libraries,
// we attempt to use C++11 std::mutex. // we attempt to use C++11 std::mutex.
#ifdef USE_CPP11_MUTEX #ifdef USE_CPP11_MUTEX_DISABLED
#include <mutex> #include <mutex>
typedef std::recursive_mutex KSysLock; // rentrant typedef std::recursive_mutex KSysLock; // rentrant
struct KAutoLock { struct KAutoLock {
@ -300,4 +300,4 @@ size_t KMemoryAllocated()
size += info.size; size += info.size;
} }
return size; return size;
} }