diff options
author | dgp <dgp@users.sourceforge.net> | 2014-02-24 21:01:07 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2014-02-24 21:01:07 (GMT) |
commit | 73bf5da01200e7f7127273188ea24d751eb75ddf (patch) | |
tree | 628a02769a3e65b56b228899667112624415869b | |
parent | 1cbe185cffc2f22761daaaaf248dbc1f80a1498a (diff) | |
download | tcl-73bf5da01200e7f7127273188ea24d751eb75ddf.zip tcl-73bf5da01200e7f7127273188ea24d751eb75ddf.tar.gz tcl-73bf5da01200e7f7127273188ea24d751eb75ddf.tar.bz2 |
simplification trims
-rw-r--r-- | generic/tclIO.c | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/generic/tclIO.c b/generic/tclIO.c index 5625ff2..1c5fed4 100644 --- a/generic/tclIO.c +++ b/generic/tclIO.c @@ -5194,7 +5194,7 @@ ReadBytes( * the bytes from the first buffer are * returned. */ { - int toRead, srcLen, length, srcRead, dstWrote; + int toRead, srcLen, length; ChannelBuffer *bufPtr; char *src, *dst; @@ -5215,37 +5215,11 @@ ReadBytes( dst = (char *) Tcl_GetByteArrayFromObj(objPtr, NULL); dst += length; -#if 1 memcpy(dst, src, (size_t) toRead); - srcRead = dstWrote = toRead; -#else - if (statePtr->flags & INPUT_NEED_NL) { - ResetFlag(statePtr, INPUT_NEED_NL); - if (*src != '\n') { - *dst = '\r'; - length += 1; - Tcl_SetByteArrayLength(objPtr, length); - return 1; - } - *dst++ = '\n'; - src++; - srcLen--; - toRead--; - } - - srcRead = srcLen; - dstWrote = toRead; - if (TranslateInputEOL(statePtr, dst, src, &dstWrote, &srcRead) != 0) { - if (dstWrote == 0) { - Tcl_SetByteArrayLength(objPtr, length); - return -1; - } - } -#endif - bufPtr->nextRemoved += srcRead; - length += dstWrote; + bufPtr->nextRemoved += toRead; + length += toRead; Tcl_SetByteArrayLength(objPtr, length); - return dstWrote; + return toRead; } /* |