diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/Makefile.am | 2 | ||||
-rw-r--r-- | src/utils/debugmemoryobject.h (renamed from src/utils/physfsmemoryobject.h) | 31 | ||||
-rw-r--r-- | src/utils/virtfsrwops.cpp | 16 |
4 files changed, 27 insertions, 24 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 099f2e4fb..6788c4512 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -886,7 +886,7 @@ SET(SRCS utils/paths.h utils/perfomance.cpp utils/perfomance.h - utils/physfsmemoryobject.h + utils/debugmemoryobject.h utils/virtfsrwops.cpp utils/virtfsrwops.h utils/virtfs.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 2bc72294e..66bb691f3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -546,7 +546,7 @@ BASE_SRC += events/actionevent.h \ utils/paths.h \ utils/perfomance.cpp \ utils/perfomance.h \ - utils/physfsmemoryobject.h \ + utils/debugmemoryobject.h \ utils/virtfsrwops.cpp \ utils/virtfsrwops.h \ utils/virtfs.cpp \ diff --git a/src/utils/physfsmemoryobject.h b/src/utils/debugmemoryobject.h index ec8ecad1f..3f1f0501e 100644 --- a/src/utils/physfsmemoryobject.h +++ b/src/utils/debugmemoryobject.h @@ -18,8 +18,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef UTILS_PHYSFSMEMORYOBJECT_H -#define UTILS_PHYSFSMEMORYOBJECT_H +#ifndef UTILS_DEBUGMEMORYOBJECT_H +#define UTILS_DEBUGMEMORYOBJECT_H #ifdef DEBUG_PHYSFS @@ -27,21 +27,24 @@ #include "localconsts.h" -struct PHYSFSMemoryObject final +namespace VirtFs { - PHYSFSMemoryObject(const char *const name, - const char *const file, - const unsigned int line) : - mName(name), - mAddFile(strprintf("%s:%u", file, line)) + struct DebugMemoryObject final { - } + DebugMemoryObject(const char *const name, + const char *const file, + const unsigned int line) : + mName(name), + mAddFile(strprintf("%s:%u", file, line)) + { + } - A_DELETE_COPY(PHYSFSMemoryObject) + A_DELETE_COPY(DebugMemoryObject) - std::string mName; - std::string mAddFile; -}; + std::string mName; + std::string mAddFile; + }; +} // VirtFs #endif // DEBUG_PHYSFS -#endif // UTILS_PHYSFSMEMORYOBJECT_H +#endif // UTILS_DEBUGMEMORYOBJECT_H diff --git a/src/utils/virtfsrwops.cpp b/src/utils/virtfsrwops.cpp index 347d26916..81c8b4726 100644 --- a/src/utils/virtfsrwops.cpp +++ b/src/utils/virtfsrwops.cpp @@ -26,8 +26,8 @@ #include "logger.h" +#include "utils/debugmemoryobject.h" #include "utils/fuzzer.h" -#include "utils/physfsmemoryobject.h" #include <map> @@ -48,7 +48,7 @@ static int openedRWops = 0; #ifdef DEBUG_PHYSFS namespace { - std::map<void*, PHYSFSMemoryObject*> mRWops; + std::map<void*, VirtFs::DebugMemoryObject*> mRWops; } // namespace static SDL_RWops *addDebugRWops(SDL_RWops *restrict const rwops, @@ -59,7 +59,7 @@ static SDL_RWops *addDebugRWops(SDL_RWops *restrict const rwops, if (!rwops) return nullptr; - mRWops[rwops] = new PHYSFSMemoryObject(name, file, line); + mRWops[rwops] = new VirtFs::DebugMemoryObject(name, file, line); return rwops; } @@ -68,14 +68,14 @@ static void deleteDebugRWops(SDL_RWops *const rwops) if (!rwops) return; - std::map<void*, PHYSFSMemoryObject*>::iterator it = mRWops.find(rwops); + 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 { - PHYSFSMemoryObject *const obj = (*it).second; + VirtFs::DebugMemoryObject *const obj = (*it).second; if (obj) { mRWops.erase(rwops); @@ -89,12 +89,12 @@ void VirtFs::reportLeaks() if (!mRWops.empty()) { logger->log("RWops leaks detected"); - std::map<void*, PHYSFSMemoryObject*>::iterator it = mRWops.begin(); - const std::map<void*, PHYSFSMemoryObject*>::iterator + 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) { - PHYSFSMemoryObject *obj = (*it).second; + VirtFs::DebugMemoryObject *obj = (*it).second; if (obj) { logger->log("file: %s at %s", obj->mName.c_str(), |