Tcl Source Code

Check-in [d76ed8a13f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In WriteChars(), eliminate the copy step through a staging buffer when it is not required for channel translation.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d76ed8a13fdff0d346762d07d40189048ae93256
User & Date: dgp 2014-01-24 21:52:59
Context
2014-01-25
21:41
sync tcl.m4 with Tk version check-in: d16f9a59ec user: jan.nijtmans tags: trunk
2014-01-24
22:00
merge trunk check-in: f00afeae97 user: dgp tags: dgp-refactor
21:52
In WriteChars(), eliminate the copy step through a staging buffer when it is not required for channe... check-in: d76ed8a13f user: dgp tags: trunk
21:45
In WriteChars(), eliminate the copy step through a staging buffer when it is not required for channe... check-in: 01ff1f0a45 user: dgp tags: core-8-5-branch
2014-01-22
19:33
improved tidy-up from branch check-in: b946fae2c6 user: dkf tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIO.c.

4194
4195
4196
4197
4198
4199
4200


4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
     * Loop over all UTF-8 characters in src, storing them in staging buffer
     * with proper EOL translation.
     */

    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) {
	    if (savedLF) {
		/*
		 * A '\n' was left over from last call to TranslateOutputEOL()
		 * and we need to store it in the staging buffer. If the
		 * channel is line-based, we will need to flush the output
		 * buffer (after translating the staging buffer).
		 */







>
>
|
|
|

|
|
|
|

<







4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211

4212
4213
4214
4215
4216
4217
4218
     * Loop over all UTF-8 characters in src, storing them in staging buffer
     * with proper EOL translation.
     */

    consumedSomething = 1;
    while (consumedSomething && (srcLen + savedLF + endEncoding > 0)) {
	consumedSomething = 0;

	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()
		 * and we need to store it in the staging buffer. If the
		 * channel is line-based, we will need to flush the output
		 * buffer (after translating the staging buffer).
		 */
4230
4231
4232
4233
4234
4235
4236
4237
4238

4239
4240
4241
4242
4243
4244
4245
	    savedLF = 0;

	    if (stageLen > stageMax) {
		savedLF = 1;
		stageLen = stageMax;
	    }
	} else {
	    memcpy(stage, src, toWrite);
	    stageLen = toWrite;

	}
	src += toWrite;
	srcLen -= toWrite;

	/*
	 * Loop over all UTF-8 characters in staging buffer, converting them
	 * to external encoding, storing them in output buffer.







|
|
>







4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
	    savedLF = 0;

	    if (stageLen > stageMax) {
		savedLF = 1;
		stageLen = stageMax;
	    }
	} else {
	    stage = (char *) src;
	    stageLen = srcLen;
	    toWrite = stageLen;
	}
	src += toWrite;
	srcLen -= toWrite;

	/*
	 * Loop over all UTF-8 characters in staging buffer, converting them
	 * to external encoding, storing them in output buffer.