summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2020-11-26 17:37:13 +0200
committerAlex Trotsenko <alex1973tr@gmail.com>2020-12-01 18:39:12 +0200
commit6e07edb260bb8c0ad67fe2e618125bd03a074b99 (patch)
treeb92be5e4ffde5dd55a0909965c4af60f804bc74c /src/corelib/io
parent97abbf3f1fe71886edff3cd5bc42ce3a9057a379 (diff)
QProcess/Unix: remove redundant checks in waitForReadyRead()
QProcessPrivate::tryReadFromChannel() returns 'true' only if we emitted readyRead() signal on the current read channel. Thus, these additional checks are unnecessary. Change-Id: Id98620cd08ee8808f60539c009986b869e517ef0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess_unix.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index f791ee94ee..9e5b26b3d6 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -749,17 +749,14 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
return false;
}
+ // This calls QProcessPrivate::tryReadFromChannel(), which returns true
+ // if we emitted readyRead() signal on the current read channel.
bool readyReadEmitted = false;
- if (qt_pollfd_check(poller.stdoutPipe(), POLLIN)) {
- bool canRead = _q_canReadStandardOutput();
- if (currentReadChannel == QProcess::StandardOutput && canRead)
- readyReadEmitted = true;
- }
- if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) {
- bool canRead = _q_canReadStandardError();
- if (currentReadChannel == QProcess::StandardError && canRead)
- readyReadEmitted = true;
- }
+ if (qt_pollfd_check(poller.stdoutPipe(), POLLIN) && _q_canReadStandardOutput())
+ readyReadEmitted = true;
+ if (qt_pollfd_check(poller.stderrPipe(), POLLIN) && _q_canReadStandardError())
+ readyReadEmitted = true;
+
if (readyReadEmitted)
return true;