From 88ab76b3b8d6f0bce701aa143b37d6167c885c9e Mon Sep 17 00:00:00 2001 From: dgp Date: Tue, 27 May 2014 13:28:41 +0000 Subject: Move code that can only matter in the first loop iteration out of the loop. --- generic/tclIO.c | 19 ++++++------------- 1 file 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. -- cgit v0.12