diff options
author | dgp <dgp@users.sourceforge.net> | 2008-05-21 20:38:06 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2008-05-21 20:38:06 (GMT) |
commit | 89a9e0dd71bca0ecc5f87508db1b101eda76688d (patch) | |
tree | e73485452a99136fe69e0b9ef17b3662d2afe29f | |
parent | 422670d42865358d830bc1a65fc7aa48904a2d71 (diff) | |
download | tcl-89a9e0dd71bca0ecc5f87508db1b101eda76688d.zip tcl-89a9e0dd71bca0ecc5f87508db1b101eda76688d.tar.gz tcl-89a9e0dd71bca0ecc5f87508db1b101eda76688d.tar.bz2 |
* generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace()
* tests/parse.test (parse-15.60): routine has no mechanism to
return the "incomplete" status of "\\\n" so calling this routine
anywhere that can be reached within a Tcl_ParseCommand() call is a
mistake. In particular, ParseComment() must not use it. [Bug 1968882].
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | generic/tclParse.c | 13 | ||||
-rw-r--r-- | tests/parse.test | 6 |
3 files changed, 21 insertions, 6 deletions
@@ -1,3 +1,11 @@ +2008-05-21 Don Porter <dgp@users.sourceforge.net> + + * generic/tclParse.c (ParseComment): The new TclParseAllWhiteSpace() + * tests/parse.test (parse-15.60): routine has no mechanism to + return the "incomplete" status of "\\\n" so calling this routine + anywhere that can be reached within a Tcl_ParseCommand() call is a + mistake. In particular, ParseComment() must not use it. [Bug 1968882]. + 2008-05-21 Donal K. Fellows <donal.k.fellows@man.ac.uk> * generic/tclNamesp.c (Tcl_SetNamespaceUnknownHandler): Corrected odd diff --git a/generic/tclParse.c b/generic/tclParse.c index b639f09..3197ac8 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -12,7 +12,7 @@ * See the file "license.terms" for information on usage and redistribution of * this file, and for a DISCLAIMER OF ALL WARRANTIES. * - * RCS: @(#) $Id: tclParse.c,v 1.62 2008/01/23 21:58:36 dgp Exp $ + * RCS: @(#) $Id: tclParse.c,v 1.62.2.1 2008/05/21 20:38:09 dgp Exp $ */ #include "tclInt.h" @@ -954,9 +954,12 @@ ParseComment( char type; int scanned; - scanned = TclParseAllWhiteSpace(p, numBytes); - p += scanned; - numBytes -= scanned; + do { + scanned = ParseWhiteSpace(p, numBytes, + &parsePtr->incomplete, &type); + p += scanned; + numBytes -= scanned; + } while (numBytes && (*p == '\n') && (p++,numBytes--)); if ((numBytes == 0) || (*p != '#')) { break; @@ -1871,7 +1874,7 @@ Tcl_SubstObj( int length, tokensLeft, code; Tcl_Token *endTokenPtr; Tcl_Obj *result, *errMsg = NULL; - CONST char *p = TclGetStringFromObj(objPtr, &length); + const char *p = TclGetStringFromObj(objPtr, &length); Tcl_Parse *parsePtr = (Tcl_Parse *) TclStackAlloc(interp, sizeof(Tcl_Parse)); diff --git a/tests/parse.test b/tests/parse.test index 5becb4c..0fed2f5 100644 --- a/tests/parse.test +++ b/tests/parse.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: parse.test,v 1.30 2007/12/13 15:26:07 dgp Exp $ +# RCS: @(#) $Id: parse.test,v 1.30.2.1 2008/05/21 20:38:09 dgp Exp $ if {[catch {package require tcltest 2.0.2}]} { puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required." @@ -884,6 +884,10 @@ test parse-15.59 {CommandComplete procedure} { # Test for Tcl Bug 684744 info complete [encoding convertfrom identity "\x00;if 1 \{"] } 0 +test parse-15.60 {CommandComplete procedure} { + # Test for Tcl Bug 1968882 + info complete \\\n +} 0 test parse-16.1 {Tcl_EvalEx, check termOffset is set correctly for non TCL_OK cases, bug 2535} { subst {[eval {return foo}]bar} |