summaryrefslogtreecommitdiffstats
path: root/generic/tclListObj.c
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-05-02 20:17:50 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-05-02 20:17:50 (GMT)
commit8c7f17abd1b362c12e5c02a08b56f80ecfb5d762 (patch)
treeef3b5e015a4811a57a9eb36926e198d8d5545c88 /generic/tclListObj.c
parent0460c501692feb12cd4c0198e99712a9ccc5d5eb (diff)
parent9af810992a3d08e5964ca72b8b6221e120fb42d8 (diff)
downloadtcl-8c7f17abd1b362c12e5c02a08b56f80ecfb5d762.zip
tcl-8c7f17abd1b362c12e5c02a08b56f80ecfb5d762.tar.gz
tcl-8c7f17abd1b362c12e5c02a08b56f80ecfb5d762.tar.bz2
Revised TclFindElement() interface.
The final argument had been bracePtr, the address of a boolean var, where the caller can be told whether or not the parsed list element was enclosed in braces. In practice, no callers really care about that. What the callers really want to know is whether the list element value exists as a literal substring of the string being parsed, or whether a call to TclCopyAndCollpase() is needed to produce the list element value. Now the final argument is changed to do what callers actually need. This is a better fit for the calls in tclParse.c, where now a good deal of post-processing checking for "naked backslashes" is no longer necessary. ***POTENTIAL INCOMPATIBILITY*** For any callers calling in via the internal stubs table who really do use the final argument explicitly to check for the enclosing brace scenario. Simply looking for the braces where they must be is the revision available to those callers, and it will backport cleanly. Tests for expanded literals quoting detection.
Diffstat (limited to 'generic/tclListObj.c')
-rw-r--r--generic/tclListObj.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/generic/tclListObj.c b/generic/tclListObj.c
index 03843b8..f330937 100644
--- a/generic/tclListObj.c
+++ b/generic/tclListObj.c
@@ -1717,7 +1717,7 @@ SetListFromAny(
const char *string;
char *s;
const char *elemStart, *nextElem;
- int lenRemain, length, estCount, elemSize, hasBrace, i, j, result;
+ int lenRemain, length, estCount, elemSize, i, j, result;
const char *limit; /* Points just after string's last byte. */
register const char *p;
register Tcl_Obj **elemPtrs;
@@ -1801,8 +1801,10 @@ SetListFromAny(
for (p=string, lenRemain=length, i=0;
lenRemain > 0;
p=nextElem, lenRemain=limit-nextElem, i++) {
+ int literal;
+
result = TclFindElement(interp, p, lenRemain, &elemStart, &nextElem,
- &elemSize, &hasBrace);
+ &elemSize, &literal);
if (result != TCL_OK) {
for (j = 0; j < i; j++) {
elemPtr = elemPtrs[j];
@@ -1827,7 +1829,7 @@ SetListFromAny(
*/
s = ckalloc(elemSize + 1);
- if (hasBrace) {
+ if (literal) {
memcpy(s, elemStart, (size_t) elemSize);
s[elemSize] = 0;
} else {