diff --git a/kmtrace/demangle.cpp b/kmtrace/demangle.cpp index d552137c..800629c9 100644 --- a/kmtrace/demangle.cpp +++ b/kmtrace/demangle.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include 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 #include +#include #ifdef Q_OS_SOLARIS #include /* index(), rindex() */ #endif + #include #include #include -#include #include #include #include @@ -54,7 +55,7 @@ struct Entry { TQIntDict *entryDict = 0; TQIntDict *symbolDict = 0; TQIntDict *formatDict = 0; -TQPtrList *entryList = 0; +std::list *entryList = 0; TQStrList *excludes = 0; const char * const 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(9973); symbolDict = new TQIntDict(9973); formatDict = new TQIntDict(9973); - entryList = new TQPtrList; + entryList = new std::list; fprintf(stderr, "Running\n"); TQCString line; diff --git a/kmtrace/match.cpp b/kmtrace/match.cpp index eebcaf0a..ee00ca43 100644 --- a/kmtrace/match.cpp +++ b/kmtrace/match.cpp @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include