diff options
author | dgp <dgp@users.sourceforge.net> | 2011-04-28 14:39:42 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2011-04-28 14:39:42 (GMT) |
commit | 311dd13184c02f63bc2e2a474f28bfbb7d31ef0a (patch) | |
tree | 0d25400a3f10a579b1905153391d01db6cb2a9d4 /generic/tclParse.c | |
parent | f12a5f957f0abf3155399f8902c9e4787013ce3d (diff) | |
download | tcl-311dd13184c02f63bc2e2a474f28bfbb7d31ef0a.zip tcl-311dd13184c02f63bc2e2a474f28bfbb7d31ef0a.tar.gz tcl-311dd13184c02f63bc2e2a474f28bfbb7d31ef0a.tar.bz2 |
New utility routines: TclIsSpaceProc() and TclCountSpaceRuns()
Use to replace calls to isspace() and their /* INTL */ risk.
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 94d9c50..4e1e8b0 100644 --- a/generic/tclParse.c +++ b/generic/tclParse.c @@ -610,6 +610,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 @@ -1758,7 +1782,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; |