summaryrefslogtreecommitdiffstats
path: root/generic
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2013-12-30 11:56:54 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2013-12-30 11:56:54 (GMT)
commit97a9d67a6651017b5b10fe38078583043b1cb1d7 (patch)
tree5f91f83d805af297fa612d00729999e38117ca23 /generic
parenta8aff291ddf774fee8b1da5ccf150cc3fddae5af (diff)
downloadtcl-97a9d67a6651017b5b10fe38078583043b1cb1d7.zip
tcl-97a9d67a6651017b5b10fe38078583043b1cb1d7.tar.gz
tcl-97a9d67a6651017b5b10fe38078583043b1cb1d7.tar.bz2
put the other definition of a trim set in the header file too
Diffstat (limited to 'generic')
-rw-r--r--generic/tclCompCmds.c7
-rw-r--r--generic/tclStringTrim.h7
-rw-r--r--generic/tclUtil.c16
3 files changed, 17 insertions, 13 deletions
diff --git a/generic/tclCompCmds.c b/generic/tclCompCmds.c
index 51ac9ed..05b6d07 100644
--- a/generic/tclCompCmds.c
+++ b/generic/tclCompCmds.c
@@ -65,13 +65,6 @@ const AuxDataType tclDictUpdateInfoType = {
FreeDictUpdateInfo, /* freeProc */
PrintDictUpdateInfo /* printProc */
};
-
-/*
- * The definition of what whitespace is stripped when [concat]enating. Must be
- * kept in synch with tclUtil.c
- */
-
-#define CONCAT_WS " \f\v\r\t\n"
/*
*----------------------------------------------------------------------
diff --git a/generic/tclStringTrim.h b/generic/tclStringTrim.h
index 63544a7..669f10b 100644
--- a/generic/tclStringTrim.h
+++ b/generic/tclStringTrim.h
@@ -50,6 +50,13 @@
"\xe3\x80\x80" /* ideographic space (U+3000) */\
"\xef\xbb\xbf" /* zero width no-break space (U+feff) */
+/*
+ * The whitespace trimming set used when [concat]enating. This is a subset of
+ * the above, and deliberately so.
+ */
+
+#define CONCAT_TRIM_SET " \f\v\r\t\n"
+
#endif /* TCL_STRING_TRIM_H */
/*
diff --git a/generic/tclUtil.c b/generic/tclUtil.c
index b089132..2d00adf 100644
--- a/generic/tclUtil.c
+++ b/generic/tclUtil.c
@@ -14,6 +14,7 @@
#include "tclInt.h"
#include "tclParse.h"
+#include "tclStringTrim.h"
#include <math.h>
/*
@@ -1768,8 +1769,7 @@ TclTrimLeft(
*/
/* The whitespace characters trimmed during [concat] operations */
-#define CONCAT_WS " \f\v\r\t\n"
-#define CONCAT_WS_SIZE (int) (sizeof(CONCAT_WS "") - 1)
+#define CONCAT_WS_SIZE (int) (sizeof(CONCAT_TRIM_SET "") - 1)
char *
Tcl_Concat(
@@ -1825,7 +1825,8 @@ Tcl_Concat(
* Trim away the leading whitespace.
*/
- trim = TclTrimLeft(element, elemLength, CONCAT_WS, CONCAT_WS_SIZE);
+ trim = TclTrimLeft(element, elemLength, CONCAT_TRIM_SET,
+ CONCAT_WS_SIZE);
element += trim;
elemLength -= trim;
@@ -1834,7 +1835,8 @@ Tcl_Concat(
* a final backslash character.
*/
- trim = TclTrimRight(element, elemLength, CONCAT_WS, CONCAT_WS_SIZE);
+ trim = TclTrimRight(element, elemLength, CONCAT_TRIM_SET,
+ CONCAT_WS_SIZE);
trim -= trim && (element[elemLength - trim - 1] == '\\');
elemLength -= trim;
@@ -1959,7 +1961,8 @@ Tcl_ConcatObj(
* Trim away the leading whitespace.
*/
- trim = TclTrimLeft(element, elemLength, CONCAT_WS, CONCAT_WS_SIZE);
+ trim = TclTrimLeft(element, elemLength, CONCAT_TRIM_SET,
+ CONCAT_WS_SIZE);
element += trim;
elemLength -= trim;
@@ -1968,7 +1971,8 @@ Tcl_ConcatObj(
* a final backslash character.
*/
- trim = TclTrimRight(element, elemLength, CONCAT_WS, CONCAT_WS_SIZE);
+ trim = TclTrimRight(element, elemLength, CONCAT_TRIM_SET,
+ CONCAT_WS_SIZE);
trim -= trim && (element[elemLength - trim - 1] == '\\');
elemLength -= trim;