summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2011-03-16 14:13:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2011-03-16 14:13:32 (GMT)
commitdca2b08daf4b0c0cd16dfdf7d6b449c0448907d2 (patch)
treec471d2de916c3cac050922646092534391a2bbca /generic
parentcb78c7f8a41f037806b2d4b1489bbd1e28f375a2 (diff)
downloadtcl-dca2b08daf4b0c0cd16dfdf7d6b449c0448907d2.zip
tcl-dca2b08daf4b0c0cd16dfdf7d6b449c0448907d2.tar.gz
tcl-dca2b08daf4b0c0cd16dfdf7d6b449c0448907d2.tar.bz2
Rewrites to eliminate isspace() calls.
Diffstat (limited to 'generic')
-rw-r--r--generic/tclBasic.c18
-rw-r--r--generic/tclParse.c21
-rw-r--r--generic/tclProc.c11
3 files changed, 22 insertions, 28 deletions
diff --git a/generic/tclBasic.c b/generic/tclBasic.c
index ea1be61..596254d 100644
--- a/generic/tclBasic.c
+++ b/generic/tclBasic.c
@@ -6481,16 +6481,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 158ff42..94d9c50 100644
--- a/generic/tclParse.c
+++ b/generic/tclParse.c
@@ -524,28 +524,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 978c5f7..c63337c 100644
--- a/generic/tclProc.c
+++ b/generic/tclProc.c
@@ -320,6 +320,8 @@ Tcl_ProcObjCmd(
}
if ((procArgs[0] == 'a') && (strncmp(procArgs, "args", 4) == 0)) {
+ int numBytes;
+
procArgs +=4;
while(*procArgs != '\0') {
if (*procArgs != ' ') {
@@ -332,12 +334,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;
}
/*