diff options
author | dgp <dgp@noemail.net> | 2011-04-28 14:44:47 (GMT) |
---|---|---|
committer | dgp <dgp@noemail.net> | 2011-04-28 14:44:47 (GMT) |
commit | 4790d8b304d62477e3b3a0e9e4ba0bb84496c066 (patch) | |
tree | c826199d351b0c6f0746a66124227d102686a420 /generic/tclParse.c | |
parent | b34545961b1a86c4fb756799b68614e2f246c015 (diff) | |
parent | ca63cde889bfbb8f70a3a8972374c20ba53112a1 (diff) | |
download | tcl-4790d8b304d62477e3b3a0e9e4ba0bb84496c066.zip tcl-4790d8b304d62477e3b3a0e9e4ba0bb84496c066.tar.gz tcl-4790d8b304d62477e3b3a0e9e4ba0bb84496c066.tar.bz2 |
New utility routines: TclIsSpaceProc() and TclCountSpaceRuns()
Use to replace calls to isspace() and their /* INTL */ risk.
FossilOrigin-Name: ef10af814d8b9963b42f8d064cc83c852b3d2adb
Diffstat (limited to 'generic/tclParse.c')
-rw-r--r-- | generic/tclParse.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/generic/tclParse.c b/generic/tclParse.c index 9bfe608..429d33a 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -611,6 +611,30 @@ Tcl_ParseCommand( /* *---------------------------------------------------------------------- * + * TclIsSpaceProc -- + * + * Report whether byte is in the set of whitespace characters used by + * Tcl to separate words in scripts or elements in lists. + * + * Results: + * Returns 1, if byte is in the set, 0 otherwise. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +int +TclIsSpaceProc( + char byte) +{ + return CHAR_TYPE(byte) & (TYPE_SPACE) || byte == '\n'; +} + +/* + *---------------------------------------------------------------------- + * * ParseWhiteSpace -- * * Scans up to numBytes bytes starting at src, consuming white space @@ -1757,7 +1781,7 @@ Tcl_ParseBraces( openBrace = 0; break; case '#' : - if (openBrace && isspace(UCHAR(src[-1]))) { + if (openBrace && TclIsSpaceProc(src[-1])) { Tcl_AppendResult(parsePtr->interp, ": possible unbalanced brace in comment", NULL); goto error; |