diff options
| author | dgp@users.sourceforge.net <dgp> | 2011-03-06 21:40:49 (GMT) |
|---|---|---|
| committer | dgp@users.sourceforge.net <dgp> | 2011-03-06 21:40:49 (GMT) |
| commit | 2931b138ee14f59f706197de4f135bf2223db194 (patch) | |
| tree | 1e5dfeeb51ead4be18b7b7c5b8ea728553409480 /generic/tclUtil.c | |
| parent | 5f6e260cef3291db67f39e2d5387f9f6bc5152ed (diff) | |
| download | tcl-2931b138ee14f59f706197de4f135bf2223db194.zip tcl-2931b138ee14f59f706197de4f135bf2223db194.tar.gz tcl-2931b138ee14f59f706197de4f135bf2223db194.tar.bz2 | |
* generic/tclBasic.c: More replacements of Tcl_UtfBackslash() calls
* generic/tclCmdMZ.c: with TclParseBackslash() where possible.
* generic/tclCompExpr.c:
* generic/tclCompile.c:
* generic/tclUtil.c:
Diffstat (limited to 'generic/tclUtil.c')
| -rw-r--r-- | generic/tclUtil.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/generic/tclUtil.c b/generic/tclUtil.c index 0dd4748..19332c8 100644 --- a/generic/tclUtil.c +++ b/generic/tclUtil.c @@ -341,11 +341,10 @@ TclFindElement(interp, list, listLength, elementPtr, nextPtr, sizePtr, * Copy a string and eliminate any backslashes that aren't in braces. * * Results: - * Count characters get copied from src to dst. Along the way, if - * backslash sequences are found outside braces, the backslashes are - * eliminated in the copy. After scanning count chars from source, a - * null character is placed at the end of dst. Returns the number - * of characters that got copied. + * Count bytes get copied from src to dst. Along the way, backslash + * sequences are substituted in the copy. After scanning count bytes + * from src, a null character is placed at the end of dst. Returns + * the number of bytes that got written to dst. * * Side effects: * None. @@ -355,26 +354,28 @@ TclFindElement(interp, list, listLength, elementPtr, nextPtr, sizePtr, int TclCopyAndCollapse(count, src, dst) - int count; /* Number of characters to copy from src. */ + int count; /* Number of bytes to copy from src. */ CONST char *src; /* Copy from here... */ char *dst; /* ... to here. */ { - register char c; - int numRead; int newCount = 0; - int backslashCount; - for (c = *src; count > 0; src++, c = *src, count--) { + while (count > 0) { + char c = *src; if (c == '\\') { - backslashCount = Tcl_UtfBackslash(src, &numRead, dst); + int numRead; + int backslashCount = TclParseBackslash(src, count, &numRead, dst); + dst += backslashCount; newCount += backslashCount; - src += numRead-1; - count -= numRead-1; + src += numRead; + count -= numRead; } else { *dst = c; dst++; newCount++; + src++; + count--; } } *dst = 0; @@ -643,7 +644,7 @@ Tcl_ScanCountedElement(string, length, flagPtr) } else { int size; - Tcl_UtfBackslash(p, &size, NULL); + TclParseBackslash(p, lastChar - p, &size, NULL); p += size-1; flags |= USE_BRACES; } |
