diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-03-29 22:04:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-03-29 22:04:43 +0300 |
commit | 05eecd6ecb0b094584ff6c9cf3c95642cf373a8b (patch) | |
tree | 07394f26ad8345969e896aa8f874ee4652ecb443 /src/fs/virtfs/virtfsrwops.cpp | |
parent | d6c52fbe02be8d81c10bda4c1d8ba80ef5ea5e81 (diff) | |
download | plus-05eecd6ecb0b094584ff6c9cf3c95642cf373a8b.tar.gz plus-05eecd6ecb0b094584ff6c9cf3c95642cf373a8b.tar.bz2 plus-05eecd6ecb0b094584ff6c9cf3c95642cf373a8b.tar.xz plus-05eecd6ecb0b094584ff6c9cf3c95642cf373a8b.zip |
Remove debug code from DEBUG_VIRTFS defines.
Diffstat (limited to 'src/fs/virtfs/virtfsrwops.cpp')
-rw-r--r-- | src/fs/virtfs/virtfsrwops.cpp | 96 |
1 files changed, 0 insertions, 96 deletions
diff --git a/src/fs/virtfs/virtfsrwops.cpp b/src/fs/virtfs/virtfsrwops.cpp index 0816b93eb..546c18e05 100644 --- a/src/fs/virtfs/virtfsrwops.cpp +++ b/src/fs/virtfs/virtfsrwops.cpp @@ -48,12 +48,6 @@ #include "fs/virtfs/virtfs.h" -#ifdef DEBUG_VIRTFS -#include "utils/debugmemoryobject.h" - -#include <map> -#endif // DEBUG_VIRTFS - #include "utils/fuzzer.h" #include "debug.h" @@ -70,70 +64,6 @@ static int openedRWops = 0; #endif // DUMP_LEAKED_RESOURCES -#ifdef DEBUG_VIRTFS -namespace -{ - std::map<void*, VirtFs::DebugMemoryObject*> mRWops; -} // namespace - -static SDL_RWops *addDebugRWops(SDL_RWops *restrict const rwops, - const char *restrict const name, - const char *restrict const file, - const unsigned line) -{ - if (!rwops) - return nullptr; - - mRWops[rwops] = new VirtFs::DebugMemoryObject(name, file, line); - return rwops; -} - -static void deleteDebugRWops(SDL_RWops *const rwops) -{ - if (!rwops) - return; - - std::map<void*, VirtFs::DebugMemoryObject*>::iterator it = - mRWops.find(rwops); - if (it == mRWops.end()) - { - logger->log("bad RWops delete: %p", static_cast<void*>(rwops)); - } - else - { - VirtFs::DebugMemoryObject *const obj = (*it).second; - if (obj) - { - mRWops.erase(rwops); - delete obj; - } - } -} - -void VirtFs::reportLeaks() -{ - if (!mRWops.empty()) - { - logger->log("RWops leaks detected"); - std::map<void*, VirtFs::DebugMemoryObject*>::iterator it = - mRWops.begin(); - const std::map<void*, VirtFs::DebugMemoryObject*>::iterator - it_end = mRWops.end(); - for (; it != it_end; ++it) - { - VirtFs::DebugMemoryObject *obj = (*it).second; - if (obj) - { - logger->log("file: %s at %s", obj->mName.c_str(), - obj->mAddFile.c_str()); - delete obj; - } - } - mRWops.clear(); - } -} -#endif // DEBUG_VIRTFS - static RWOPSINT virtfsrwops_seek(SDL_RWops *const rw, const RWOPSINT offset, const int whence) @@ -273,9 +203,6 @@ static int virtfsrwops_close(SDL_RWops *const rw) logger->assertLog("virtfsrwops_seek: closing already closed RWops"); openedRWops --; #endif // DUMP_LEAKED_RESOURCES -#ifdef DEBUG_VIRTFS - deleteDebugRWops(rw); -#endif // DEBUG_VIRTFS return 0; } /* virtfsrwops_close */ @@ -347,14 +274,7 @@ static bool checkFilePath(const std::string &restrict fname) } #endif // __APPLE__ -#ifdef DEBUG_VIRTFS -#undef RWopsOpenRead -SDL_RWops *VirtFs::RWopsOpenRead(const std::string &restrict fname, - const char *restrict const file, - const unsigned line) -#else // DEBUG_VIRTFS SDL_RWops *VirtFs::RWopsOpenRead(const std::string &restrict fname) -#endif // DEBUG_VIRTFS { BLOCK_START("RWopsopenRead") #ifdef __APPLE__ @@ -367,29 +287,13 @@ SDL_RWops *VirtFs::RWopsOpenRead(const std::string &restrict fname) #endif // USE_FUZZER #ifdef USE_PROFILER -#ifdef DEBUG_VIRTFS - SDL_RWops *const ret = addDebugRWops( - create_rwops(VirtFs::openRead(fname)), - fname, - file, - line); -#else // DEBUG_VIRTFS SDL_RWops *const ret = create_rwops(VirtFs::openRead(fname)); -#endif // DEBUG_VIRTFS BLOCK_END("RWopsopenRead") return ret; #else // USE_PROFILER -#ifdef DEBUG_VIRTFS - return addDebugRWops( - create_rwops(VirtFs::openRead(fname)), - fname, - file, - line); -#else // DEBUG_VIRTFS return create_rwops(VirtFs::openRead(fname)); -#endif // DEBUG_VIRTFS #endif // USE_PROFILER } /* RWopsopenRead */ |