summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-01-24 17:38:59 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-01-24 17:38:59 (GMT)
commit8af83eeffaedc4ee57ade8026a6f7166b86306d6 (patch)
tree47806a38c9d445ea76ce0943646a49caa819a7fe /generic
parentc7ed456462861ff7aaef003c61d8fc526466017d (diff)
downloadtcl-8af83eeffaedc4ee57ade8026a6f7166b86306d6.zip
tcl-8af83eeffaedc4ee57ade8026a6f7166b86306d6.tar.gz
tcl-8af83eeffaedc4ee57ade8026a6f7166b86306d6.tar.bz2
Eliminate the copy to a staging buffer when that serves no functional purpose.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclIO.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index f1d8909..13494ca 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -3787,16 +3787,17 @@ WriteChars(
consumedSomething = 1;
while (consumedSomething && (srcLen + savedLF + endEncoding > 0)) {
consumedSomething = 0;
- stage = statePtr->outputStage;
- stageMax = statePtr->bufSize;
- stageLen = stageMax;
-
- toWrite = stageLen;
- if (toWrite > srcLen) {
- toWrite = srcLen;
- }
if (translate) {
+ stage = statePtr->outputStage;
+ stageMax = statePtr->bufSize;
+ stageLen = stageMax;
+
+ toWrite = stageLen;
+ if (toWrite > srcLen) {
+ toWrite = srcLen;
+ }
+
if (savedLF) {
/*
* A '\n' was left over from last call to TranslateOutputEOL()
@@ -3822,8 +3823,9 @@ WriteChars(
stageLen = stageMax;
}
} else {
- memcpy(stage, src, toWrite);
- stageLen = toWrite;
+ stage = (char *) src;
+ stageLen = srcLen;
+ toWrite = stageLen;
}
src += toWrite;
srcLen -= toWrite;