summaryrefslogtreecommitdiffstats
path: root/generic/tclIO.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-08-22 13:20:21 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-08-22 13:20:21 (GMT)
commitb08dc28c80317173b7bcfdf2eee65f68255b0d52 (patch)
tree5ce08e6e9a603476f670e79665f63e7efb7e3eac /generic/tclIO.c
parent92f9aca55f1770a3bd88a0f48e2da3d17856d61b (diff)
downloadtcl-b08dc28c80317173b7bcfdf2eee65f68255b0d52.zip
tcl-b08dc28c80317173b7bcfdf2eee65f68255b0d52.tar.gz
tcl-b08dc28c80317173b7bcfdf2eee65f68255b0d52.tar.bz2
Same results; simpler logic.
Diffstat (limited to 'generic/tclIO.c')
-rw-r--r--generic/tclIO.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index 4f81770..93ac937 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -8853,36 +8853,22 @@ DoRead(
break;
}
- /* If there is no full buffer, attempt to create and/or fill one. */
-
-if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) {
- while (!IsBufferFull(bufPtr)) {
- int code;
+ /*
+ * If there is not enough data in the buffers to possibly
+ * complete the read, then go get more.
+ */
+ if (bufPtr == NULL || BytesLeft(bufPtr) < bytesToRead) {
moreData:
- code = GetInput(chanPtr);
- bufPtr = statePtr->inQueueHead;
-
- assert (bufPtr != NULL);
-
- if (GotFlag(statePtr, CHANNEL_EOF|CHANNEL_BLOCKED)) {
- /* Further reads cannot do any more */
- break;
- }
-
- if (code) {
+ if (GetInput(chanPtr)) {
/* Read error */
UpdateInterest(chanPtr);
TclChannelRelease((Tcl_Channel)chanPtr);
return -1;
}
-
- assert (IsBufferFull(bufPtr));
+ bufPtr = statePtr->inQueueHead;
}
- assert (bufPtr != NULL);
-}
-
bytesRead = BytesLeft(bufPtr);
bytesWritten = bytesToRead;