Tcl Source Code

Check-in [01ff1f0a45]
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 | core-8-5-branch
Files: files | file ages | folders
SHA1: 01ff1f0a4553e0c2b3b938ab9aaad6e69556f983
User & Date: dgp 2014-01-24 21:45:39
Context
2014-01-25
21:41
sync tcl.m4 with Tk version check-in: fc06c2939f user: jan.nijtmans tags: core-8-5-branch
2014-01-24
22:33
merge 8.5 check-in: 3920660b95 user: dgp tags: dgp-read-bytes
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
17:38
Eliminate the copy to a staging buffer when that serves no functional purpose. check-in: 68c21e5139 user: dgp tags: dgp-optimize-output-stage
2014-01-21
18:16
Silence compiler warnings. check-in: 76fb868129 user: dgp tags: core-8-5-branch
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to generic/tclIO.c.

3783
3784
3785
3786
3787
3788
3789


3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
     * 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).
		 */







>
>
|
|
|

|
|
|
|

<







3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800

3801
3802
3803
3804
3805
3806
3807
     * 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).
		 */
3818
3819
3820
3821
3822
3823
3824
3825
3826

3827
3828
3829
3830
3831
3832
3833
	    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.







|
|
>







3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
	    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.