diff options
author | sebres <sebres@users.sourceforge.net> | 2020-06-02 17:05:50 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2020-06-02 17:05:50 (GMT) |
commit | 1d722dd564f086e6aeda78f707816ebb3869146f (patch) | |
tree | 8a5989c7ad0e63f991e972f7262f6f824fdf2788 /generic/tclParse.c | |
parent | 6e8b20f551e5ffc2fa7d28a3f1cd58d2de3fd6cf (diff) | |
parent | f5073685562dc7045d0f2a89722d4d948a3500b9 (diff) | |
download | tcl-1d722dd564f086e6aeda78f707816ebb3869146f.zip tcl-1d722dd564f086e6aeda78f707816ebb3869146f.tar.gz tcl-1d722dd564f086e6aeda78f707816ebb3869146f.tar.bz2 |
merge 8.5
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 25304407..78f3a9e 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -259,6 +259,10 @@ Tcl_ParseCommand( * point to char after terminating one. */ int scanned; + if (numBytes < 0 && start) { + numBytes = strlen(start); + } + TclParseInit(interp, start, numBytes, parsePtr); if ((start == NULL) && (numBytes != 0)) { if (interp != NULL) { Tcl_SetObjResult(interp, Tcl_NewStringObj( @@ -266,10 +270,6 @@ Tcl_ParseCommand( } return TCL_ERROR; } - if (numBytes < 0) { - numBytes = strlen(start); - } - TclParseInit(interp, start, numBytes, parsePtr); parsePtr->commentStart = NULL; parsePtr->commentSize = 0; parsePtr->commandStart = NULL; @@ -1413,16 +1413,15 @@ Tcl_ParseVarName( int varIndex; unsigned array; - if ((numBytes == 0) || (start == NULL)) { - return TCL_ERROR; - } - if (numBytes < 0) { + if (numBytes < 0 && start) { numBytes = strlen(start); } - if (!append) { TclParseInit(interp, start, numBytes, parsePtr); } + if ((numBytes == 0) || (start == NULL)) { + return TCL_ERROR; + } /* * Generate one token for the variable, an additional token for the name, @@ -1695,16 +1694,15 @@ Tcl_ParseBraces( register const char *src; int startIndex, level, length; - if ((numBytes == 0) || (start == NULL)) { - return TCL_ERROR; - } - if (numBytes < 0) { + if (numBytes < 0 && start) { numBytes = strlen(start); } - if (!append) { TclParseInit(interp, start, numBytes, parsePtr); } + if ((numBytes == 0) || (start == NULL)) { + return TCL_ERROR; + } src = start; startIndex = parsePtr->numTokens; @@ -1893,16 +1891,15 @@ Tcl_ParseQuotedString( * the quoted string's terminating close-quote * if the parse succeeds. */ { - if ((numBytes == 0) || (start == NULL)) { - return TCL_ERROR; - } - if (numBytes < 0) { + if (numBytes < 0 && start) { numBytes = strlen(start); } - if (!append) { TclParseInit(interp, start, numBytes, parsePtr); } + if ((numBytes == 0) || (start == NULL)) { + return TCL_ERROR; + } if (TCL_OK != ParseTokens(start+1, numBytes-1, TYPE_QUOTE, TCL_SUBST_ALL, parsePtr)) { |