summaryrefslogtreecommitdiffstats
path: root/kmtrace/kmtrace.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmtrace/kmtrace.cpp')
-rw-r--r--kmtrace/kmtrace.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/kmtrace/kmtrace.cpp b/kmtrace/kmtrace.cpp
index eaa9668f..477cae7d 100644
--- a/kmtrace/kmtrace.cpp
+++ b/kmtrace/kmtrace.cpp
@@ -1,9 +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 <tqsortedlist.h>
#include <tqfile.h>
#include <tqtl.h>
#include <tqvaluelist.h>
@@ -51,7 +55,7 @@ struct Entry {
TQIntDict<Entry> *entryDict = 0;
TQIntDict<char> *symbolDict = 0;
TQIntDict<char> *formatDict = 0;
-TQSortedList<Entry> *entryList = 0;
+std::list<Entry*> *entryList = 0;
TQStrList *excludes = 0;
const char * const unknown = "<unknown>";
@@ -152,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()
@@ -292,7 +296,7 @@ void lookupUnknownSymbols(const char *appname)
int match(const char *s1, const char *s2)
{
- register int result;
+ int result;
while(true)
{
result = *s1 - *s2;
@@ -356,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++)
{
@@ -372,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);
@@ -428,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;
@@ -619,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 TQSortedList<Entry>;
+ entryList = new std::list<Entry*>;
fprintf(stderr, "Running\n");
TQCString line;