diff options
author | Michele Calgaro <[email protected]> | 2023-06-23 15:47:02 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2023-06-23 17:29:03 +0900 |
commit | 3523578cf170d9e98e2c0c5b2f3b6f7de4318a03 (patch) | |
tree | 62e02dd72df04ac38ed54c40dea6c6a7f6f8778b /kmtrace/kmtrace.cpp | |
parent | d619f66af0df2e6f9a1cb0a41f17e98e1f48d309 (diff) | |
download | tdesdk-3523578cf170d9e98e2c0c5b2f3b6f7de4318a03.tar.gz tdesdk-3523578cf170d9e98e2c0c5b2f3b6f7de4318a03.zip |
Fix functionality broken by commit d619f66
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'kmtrace/kmtrace.cpp')
-rw-r--r-- | kmtrace/kmtrace.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/kmtrace/kmtrace.cpp b/kmtrace/kmtrace.cpp index 6e30b01c..477cae7d 100644 --- a/kmtrace/kmtrace.cpp +++ b/kmtrace/kmtrace.cpp @@ -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; |