diff options
author | dgp <dgp@users.sourceforge.net> | 2014-05-27 13:28:41 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-05-27 13:28:41 (GMT) |
commit | 00ef775fc158959acc2c14c5ff3568e1f86fe538 (patch) | |
tree | 6e5c0491dd583fb852fe98ab933205c11f62a22b /generic | |
parent | 7e7fc66d0c49405ff64c193170207ba58c33301f (diff) | |
download | tcl-00ef775fc158959acc2c14c5ff3568e1f86fe538.zip tcl-00ef775fc158959acc2c14c5ff3568e1f86fe538.tar.gz tcl-00ef775fc158959acc2c14c5ff3568e1f86fe538.tar.bz2 |
Move code that can only matter in the first loop iteration out of the loop.
Diffstat (limited to 'generic')
-rw-r--r-- | generic/tclIO.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 9e1a723..4e325ba 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -2510,12 +2510,6 @@ FlushChannel( return -1; } - /* - * Loop over the queued buffers and attempt to flush as much as possible - * of the queued output to the channel. - */ - - while (1) { /* * If the queue is empty and there is a ready current buffer, OR if * the current buffer is full, then move the current buffer to the @@ -2536,7 +2530,6 @@ FlushChannel( statePtr->outQueueTail = statePtr->curOutPtr; statePtr->curOutPtr = NULL; } - bufPtr = statePtr->outQueueHead; /* * If we are not being called from an async flush and an async flush @@ -2547,13 +2540,13 @@ FlushChannel( return 0; } - /* - * If the output queue is still empty, break out of the while loop. - */ + /* + * Loop over the queued buffers and attempt to flush as much as possible + * of the queued output to the channel. + */ - if (bufPtr == NULL) { - break; /* Out of the "while (1)". */ - } + while (statePtr->outQueueHead) { + bufPtr = statePtr->outQueueHead; /* * Produce the output on the channel. |