Fix functionality broken by commit d619f66

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/19/head
Michele Calgaro 1 year ago
parent d619f66af0
commit 3523578cf1
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -3,7 +3,6 @@
#include <tqstringlist.h>
#include <tqstrlist.h>
#include <tqtextstream.h>
#include <tqptrlist.h>
#include <tqfile.h>
#include <tqtl.h>
#include <tqvaluelist.h>

@ -1,12 +1,13 @@
#include <tqintdict.h>
#include <stdio.h>
#include <list>
#ifdef Q_OS_SOLARIS
#include <strings.h> /* index(), rindex() */
#endif
#include <tqstringlist.h>
#include <tqstrlist.h>
#include <tqtextstream.h>
#include <tqptrlist.h>
#include <tqfile.h>
#include <tqtl.h>
#include <tqvaluelist.h>
@ -54,7 +55,7 @@ struct Entry {
TQIntDict<Entry> *entryDict = 0;
TQIntDict<char> *symbolDict = 0;
TQIntDict<char> *formatDict = 0;
TQPtrList<Entry> *entryList = 0;
std::list<Entry*> *entryList = 0;
TQStrList *excludes = 0;
const char * const unknown = "<unknown>";
@ -155,14 +156,14 @@ void sortBlocks()
{
Entry *entry = it.current();
totalBytesLeaked += entry->total_size;
entryList->append(entry);
entryList->push_back(entry);
for(int i = 0; entry->backtrace[i]; i++)
{
if (!symbolDict->find(entry->backtrace[i]))
symbolDict->insert(entry->backtrace[i], unknown);
}
}
entryList->sort();
entryList->sort([](Entry *a, Entry *b) { return *a < *b; });
}
void collectDupes()
@ -359,7 +360,7 @@ void dumpBlocks()
{
int filterBytes = 0;
int filterCount = 0;
for(Entry *entry = entryList->first();entry; entry = entryList->next())
for (Entry *entry : *entryList)
{
for(int i = 0; entry->backtrace[i]; i++)
{
@ -375,7 +376,7 @@ void dumpBlocks()
filterCount++;
}
printf("Leaked memory after filtering: %d bytes in %d blocks.\n", filterBytes, filterCount);
for(Entry *entry = entryList->first();entry; entry = entryList->next())
for (Entry *entry : *entryList)
{
if (!entry->total_size) continue;
printf("[%d bytes in %d blocks, 1st. block is %d bytes at 0x%08x] ", entry->total_size, entry->count, entry->size, entry->base);
@ -431,8 +432,7 @@ TreeList * treeList = 0;
void buildTree ()
{
for (Entry * entry = entryList->first ();
entry != NULL; entry = entryList->next ())
for (Entry *entry : *entryList)
{
if (!entry->total_size)
continue;
@ -622,7 +622,7 @@ int main(int argc, char *argv[])
entryDict = new TQIntDict<Entry>(9973);
symbolDict = new TQIntDict<char>(9973);
formatDict = new TQIntDict<char>(9973);
entryList = new TQPtrList<Entry>;
entryList = new std::list<Entry*>;
fprintf(stderr, "Running\n");
TQCString line;

@ -3,7 +3,6 @@
#include <tqstringlist.h>
#include <tqstrlist.h>
#include <tqtextstream.h>
#include <tqptrlist.h>
#include <tqfile.h>
#include <tqtl.h>
#include <tqvaluelist.h>

Loading…
Cancel
Save