summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2014-01-24 21:52:59 (GMT)
committerdgp <dgp@users.sourceforge.net>2014-01-24 21:52:59 (GMT)
commitba25abd391cd3ba24b8a75f1276ac6b9561ee490 (patch)
tree6bac5a408e8e530934fa88f506f2003b61a03a6d
parentd007f17bcd05bca0bcceafe9a712b0a1b3b3f020 (diff)
parentb6f970f792d9528b3ea467025e95d04e4b1b19f4 (diff)
downloadtcl-ba25abd391cd3ba24b8a75f1276ac6b9561ee490.zip
tcl-ba25abd391cd3ba24b8a75f1276ac6b9561ee490.tar.gz
tcl-ba25abd391cd3ba24b8a75f1276ac6b9561ee490.tar.bz2
In WriteChars(), eliminate the copy step through a staging buffer when it
is not required for channel translation.
-rw-r--r--generic/tclIO.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c
index f1d85bf..321f485 100644
--- a/generic/tclIO.c
+++ b/generic/tclIO.c
@@ -4198,16 +4198,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()
@@ -4234,8 +4235,9 @@ WriteChars(
stageLen = stageMax;
}
} else {
- memcpy(stage, src, toWrite);
- stageLen = toWrite;
+ stage = (char *) src;
+ stageLen = srcLen;
+ toWrite = stageLen;
}
src += toWrite;
srcLen -= toWrite;