summaryrefslogtreecommitdiff
path: root/src/utils/physfscheckutils.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-20 22:52:43 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-20 23:03:44 +0300
commit2c844378584de4d0540766d71c906a189bff95fa (patch)
tree91c1e4f3fe4559a14951a6663d29a0773b771284 /src/utils/physfscheckutils.cpp
parentd75ab9a77c15b7a99dcd5051846e4978c3ab71c1 (diff)
downloadmv-2c844378584de4d0540766d71c906a189bff95fa.tar.gz
mv-2c844378584de4d0540766d71c906a189bff95fa.tar.bz2
mv-2c844378584de4d0540766d71c906a189bff95fa.tar.xz
mv-2c844378584de4d0540766d71c906a189bff95fa.zip
Move physfsmemoryobject into separate file.
Diffstat (limited to 'src/utils/physfscheckutils.cpp')
-rw-r--r--src/utils/physfscheckutils.cpp30
1 files changed, 9 insertions, 21 deletions
diff --git a/src/utils/physfscheckutils.cpp b/src/utils/physfscheckutils.cpp
index 103726e19..68e636e9e 100644
--- a/src/utils/physfscheckutils.cpp
+++ b/src/utils/physfscheckutils.cpp
@@ -26,6 +26,7 @@
#include "utils/stringutils.h"
+#include "utils/physfsmemoryobject.h"
#include "utils/physfsrwops.h"
#include <map>
@@ -34,21 +35,7 @@
namespace
{
- struct MemoryObject
- {
- MemoryObject(const char *const name,
- const char *const file,
- const unsigned int line) :
- mName(name),
- mAddFile(strprintf("%s:%u", file, line))
- {
- }
-
- std::string mName;
- std::string mAddFile;
- };
-
- std::map<void*, MemoryObject*> mRWops;
+ std::map<void*, PHYSFSMemoryObject*> mRWops;
} // namespace
static SDL_RWops *addRWops(SDL_RWops *restrict const rwops,
@@ -59,7 +46,7 @@ static SDL_RWops *addRWops(SDL_RWops *restrict const rwops,
if (!rwops)
return nullptr;
- mRWops[rwops] = new MemoryObject(name, file, line);
+ mRWops[rwops] = new PHYSFSMemoryObject(name, file, line);
return rwops;
}
@@ -68,14 +55,14 @@ static void deleteRWops(SDL_RWops *const rwops)
if (!rwops)
return;
- std::map<void*, MemoryObject*>::iterator it = mRWops.find(rwops);
+ std::map<void*, PHYSFSMemoryObject*>::iterator it = mRWops.find(rwops);
if (it == mRWops.end())
{
logger->log("bad RWops delete: %p", static_cast<void*>(rwops));
}
else
{
- MemoryObject *const obj = (*it).second;
+ PHYSFSMemoryObject *const obj = (*it).second;
if (obj)
{
mRWops.erase(rwops);
@@ -101,11 +88,12 @@ void reportPhysfsLeaks()
if (!mRWops.empty())
{
logger->log("RWops leaks detected");
- std::map<void*, MemoryObject*>::iterator it = mRWops.begin();
- const std::map<void*, MemoryObject*>::iterator it_end = mRWops.end();
+ std::map<void*, PHYSFSMemoryObject*>::iterator it = mRWops.begin();
+ const std::map<void*, PHYSFSMemoryObject*>::iterator
+ it_end = mRWops.end();
for (; it != it_end; ++it)
{
- MemoryObject *obj = (*it).second;
+ PHYSFSMemoryObject *obj = (*it).second;
if (obj)
{
logger->log("file: %s at %s", obj->mName.c_str(),