mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 02:11:30 +00:00
removed DBMemLeak.cpp and DBMemLeak.h, unused.
This commit is contained in:
parent
cdc7b2a000
commit
e9577db9c2
@ -10,7 +10,6 @@ SET(common_sources
|
||||
database.cpp
|
||||
dbasync.cpp
|
||||
dbcore.cpp
|
||||
DBMemLeak.cpp
|
||||
debug.cpp
|
||||
emu_opcodes.cpp
|
||||
EmuTCPConnection.cpp
|
||||
@ -103,7 +102,6 @@ SET(common_headers
|
||||
database.h
|
||||
dbasync.h
|
||||
dbcore.h
|
||||
DBMemLeak.h
|
||||
debug.h
|
||||
deity.h
|
||||
emu_opcodes.h
|
||||
|
||||
@ -1,62 +0,0 @@
|
||||
#ifdef _EQDEBUG
|
||||
#include "../common/debug.h"
|
||||
#include <windows.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "../common/Mutex.h"
|
||||
#include "DBMemLeak.h"
|
||||
|
||||
#include <crtdbg.h>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#endif
|
||||
|
||||
DBMemLeak dbmemleak;
|
||||
LinkedList<DBMemLeakStruct*>* list = 0;
|
||||
Mutex MDBMemLeak;
|
||||
|
||||
DBMemLeak::DBMemLeak() {
|
||||
list = new LinkedList<DBMemLeakStruct*>;
|
||||
}
|
||||
|
||||
DBMemLeak::~DBMemLeak() {
|
||||
LinkedListIterator<DBMemLeakStruct*> iterator(*list);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
char tmp[200];
|
||||
snprintf(tmp, sizeof(tmp) - 3, "DB Mem Leak: Block=%6d, Query=%s", iterator.GetData()->memblock, iterator.GetData()->query);
|
||||
snprintf(tmp, sizeof(tmp), "%s\n", tmp);
|
||||
OutputDebugString(tmp);
|
||||
iterator.Advance();
|
||||
}
|
||||
safe_delete(list);
|
||||
}
|
||||
|
||||
void DBMemLeak::Alloc(const void* result, const char* query) {
|
||||
LockMutex lock(&MDBMemLeak);
|
||||
long requestNumber;
|
||||
uint8* tmp2 = new uint8;
|
||||
_CrtIsMemoryBlock( tmp2, 1, &requestNumber, 0, 0 );
|
||||
safe_delete(tmp2);
|
||||
DBMemLeakStruct* tmp = (DBMemLeakStruct*) new uchar[sizeof(DBMemLeakStruct) + strlen(query) + 1];
|
||||
tmp->result = result;
|
||||
tmp->memblock = requestNumber;
|
||||
strcpy(tmp->query, query);
|
||||
list->Append(tmp);
|
||||
}
|
||||
|
||||
void DBMemLeak::Free(const void* result) {
|
||||
LockMutex lock(&MDBMemLeak);
|
||||
LinkedListIterator<DBMemLeakStruct*> iterator(*list);
|
||||
iterator.Reset();
|
||||
while (iterator.MoreElements()) {
|
||||
if (result == iterator.GetData()->result)
|
||||
iterator.RemoveCurrent();
|
||||
else
|
||||
iterator.Advance();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -1,25 +0,0 @@
|
||||
#ifdef _EQDEBUG
|
||||
#ifndef DBMemLeak_H
|
||||
#define DBMemLeak_H
|
||||
#include "../common/types.h"
|
||||
#include "../common/linked_list.h"
|
||||
|
||||
#define mysql_free_result(r) { DBMemLeak::Free(r); mysql_free_result(r); }
|
||||
|
||||
struct DBMemLeakStruct {
|
||||
const void* result;
|
||||
uint32 memblock;
|
||||
char query[0];
|
||||
};
|
||||
|
||||
class DBMemLeak {
|
||||
public:
|
||||
DBMemLeak();
|
||||
~DBMemLeak();
|
||||
|
||||
static void Alloc(const void* result, const char* query);
|
||||
static void Free(const void* result);
|
||||
};
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@ -7,7 +7,6 @@
|
||||
//#include <winsock.h>
|
||||
#endif
|
||||
#include <mysql.h>
|
||||
#include "../common/DBMemLeak.h"
|
||||
#include "../common/types.h"
|
||||
#include "../common/Mutex.h"
|
||||
#include "../common/linked_list.h"
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
#include "shareddb.h"
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "shareddb.h"
|
||||
#include "mysql.h"
|
||||
#include "Item.h"
|
||||
#include "classes.h"
|
||||
#include "rulesys.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user