Commit 80e89b23 authored by Oswald Buddenhagen's avatar Oswald Buddenhagen
Browse files

optimize output receiver somewhat

parent 0acae6f8
...@@ -554,24 +554,29 @@ void GdbEngine::readGdbStandardError() ...@@ -554,24 +554,29 @@ void GdbEngine::readGdbStandardError()
void GdbEngine::readGdbStandardOutput() void GdbEngine::readGdbStandardOutput()
{ {
int newstart = 0;
int scan = m_inbuffer.size();
m_inbuffer.append(m_gdbProc.readAllStandardOutput()); m_inbuffer.append(m_gdbProc.readAllStandardOutput());
int newstart = 0;
while (newstart < m_inbuffer.size()) { while (newstart < m_inbuffer.size()) {
int start = newstart; int start = newstart;
int end = m_inbuffer.indexOf('\n', start); int end = m_inbuffer.indexOf('\n', scan);
if (end < 0) { if (end < 0) {
m_inbuffer.remove(0, start); m_inbuffer.remove(0, start);
return; return;
} }
newstart = end + 1; newstart = end + 1;
scan = newstart;
if (end == start) if (end == start)
continue; continue;
#ifdef Q_OS_WIN
if (m_inbuffer.at(end - 1) == '\r') { if (m_inbuffer.at(end - 1) == '\r') {
--end; --end;
if (end == start) if (end == start)
continue; continue;
} }
#endif
handleResponse(QByteArray::fromRawData(m_inbuffer.constData() + start, end - start)); handleResponse(QByteArray::fromRawData(m_inbuffer.constData() + start, end - start));
} }
m_inbuffer.clear(); m_inbuffer.clear();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment