summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--generic/tclBasic.c23
-rw-r--r--generic/tclParse.c21
-rw-r--r--generic/tclProc.c13
4 files changed, 29 insertions, 34 deletions
diff --git a/ChangeLog b/ChangeLog
index 36a5820..ce1d1c8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-03-16 Don Porter <dgp@users.sourceforge.net>
+
+ * generic/tclBasic.c: Some rewrites to eliminate calls to
+ * generic/tclParse.c: isspace() and their /* INTL */ risk.
+ * generic/tclProc.c:
+
2011-03-16 Jan Nijtmans <nijtmans@users.sf.net>
* unix/tcl.m4: Make SHLIB_LD_LIBS='${LIBS}' the default and
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index adf8e2d..5f2b301 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -7418,21 +7418,16 @@ ExprAbsFunc(
goto unChanged;
} else if (l == (long)0) {
const char *string = objv[1]->bytes;
-
- if (!string) {
- /*
- * There is no string representation, so internal one is
- * correct.
- */
-
- goto unChanged;
- }
- while (isspace(UCHAR(*string))) {
- string++;
- }
- if (*string != '-') {
- goto unChanged;
+ if (string) {
+ while (*string != '0') {
+ if (*string == '-') {
+ Tcl_SetObjResult(interp, Tcl_NewLongObj(0));
+ return TCL_OK;
+ }
+ string++;
+ }
}
+ goto unChanged;
} else if (l == LONG_MIN) {
TclBNInitBignumFromLong(&big, l);
goto tooLarge;
diff --git a/generic/tclParse.c b/generic/tclParse.c
index 3650677..9bfe608 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -525,28 +525,23 @@ Tcl_ParseCommand(
*/
nextElem = tokenPtr[1].start;
- while (isspace(UCHAR(*nextElem))) {
- nextElem++;
- }
while (nextElem < listEnd) {
+ int quoted, brace;
+
tokenPtr->type = TCL_TOKEN_SIMPLE_WORD;
tokenPtr->numComponents = 1;
- tokenPtr->start = nextElem;
tokenPtr++;
tokenPtr->type = TCL_TOKEN_TEXT;
tokenPtr->numComponents = 0;
TclFindElement(NULL, nextElem, listEnd - nextElem,
&(tokenPtr->start), &nextElem,
- &(tokenPtr->size), NULL);
- if (tokenPtr->start + tokenPtr->size == listEnd) {
- tokenPtr[-1].size = listEnd - tokenPtr[-1].start;
- } else {
- tokenPtr[-1].size = tokenPtr->start
- + tokenPtr->size - tokenPtr[-1].start;
- tokenPtr[-1].size += (isspace(UCHAR(
- tokenPtr->start[tokenPtr->size])) == 0);
- }
+ &(tokenPtr->size), &brace);
+
+ quoted = brace || tokenPtr->start[-1] == '"';
+ tokenPtr[-1].start = tokenPtr->start - quoted;
+ tokenPtr[-1].size = tokenPtr->start + tokenPtr->size
+ - tokenPtr[-1].start + quoted;
tokenPtr++;
}
diff --git a/generic/tclProc.c b/generic/tclProc.c
index a4309b6..6cd5bb2 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -330,7 +330,9 @@ Tcl_ProcObjCmd(
}
if ((procArgs[0] == 'a') && (strncmp(procArgs, "args", 4) == 0)) {
- procArgs += 4;
+ int numBytes;
+
+ procArgs +=4;
while (*procArgs != '\0') {
if (*procArgs != ' ') {
goto done;
@@ -342,12 +344,9 @@ Tcl_ProcObjCmd(
* The argument list is just "args"; check the body
*/
- procBody = TclGetString(objv[3]);
- while (*procBody != '\0') {
- if (!isspace(UCHAR(*procBody))) {
- goto done;
- }
- procBody++;
+ procBody = Tcl_GetStringFromObj(objv[3], &numBytes);
+ if (TclParseAllWhiteSpace(procBody, numBytes) < numBytes) {
+ goto done;
}
/*