]> git.cworth.org Git - apitrace/commitdiff
Process stderr one line at time.
authorJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 24 Mar 2012 10:06:56 +0000 (10:06 +0000)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 24 Mar 2012 10:06:56 +0000 (10:06 +0000)
Instead of reading all into memory.

Benefit is probably only marginal, but code is equally lean.

gui/retracer.cpp

index 865f61fcb5d1004822428e2cff915e31de76d542..fa220117f0c5bb9de24d490d0b5d5c07f2ed7e53 100644 (file)
@@ -255,11 +255,11 @@ void RetraceProcess::replayFinished(int exitCode, QProcess::ExitStatus exitStatu
         }
     }
 
-    QString errStr = m_process->readAllStandardError();
-    QStringList errorLines = errStr.split('\n');
+    m_process->setReadChannel(QProcess::StandardError);
     QList<ApiTraceError> errors;
-    QRegExp regexp("(^\\d+): +(\\b\\w+\\b): (.+$)");
-    foreach(QString line, errorLines) {
+    QRegExp regexp("(^\\d+): +(\\b\\w+\\b): ([^\\r\\n]+)[\\r\\n]*$");
+    while (!m_process->atEnd()) {
+        QString line = m_process->readLine();
         if (regexp.indexIn(line) != -1) {
             ApiTraceError error;
             error.callIndex = regexp.cap(1).toInt();