summaryrefslogtreecommitdiffstats
path: root/generic/tclStringRep.h
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-03-30 18:01:48 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-03-30 18:01:48 (GMT)
commit5a1359a5e8aa149cea117f4f34239cd3a23872f4 (patch)
tree85a0e53462d5b6da6b74451e0c3f9d59004369ed /generic/tclStringRep.h
parentedb3e7b8d2efcb3a1282f910f1e7120d5d34c6f8 (diff)
downloadtcl-5a1359a5e8aa149cea117f4f34239cd3a23872f4.zip
tcl-5a1359a5e8aa149cea117f4f34239cd3a23872f4.tar.gz
tcl-5a1359a5e8aa149cea117f4f34239cd3a23872f4.tar.bz2
TIP 660. No compiler warnings. Tests suite pass on Win and Ubuntu
Diffstat (limited to 'generic/tclStringRep.h')
-rw-r--r--generic/tclStringRep.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h
index ab52ea8..d39f705 100644
--- a/generic/tclStringRep.h
+++ b/generic/tclStringRep.h
@@ -68,6 +68,10 @@ typedef struct {
* field above. */
} String;
+/* Limit on string lengths. The -1 because limit does not include the nul */
+#define STRING_MAXCHARS \
+ ((Tcl_Size)((TCL_SIZE_MAX - offsetof(String, unicode))/sizeof(Tcl_UniChar) - 1))
+/* Memory needed to hold a string of length numChars - including NUL */
#define STRING_SIZE(numChars) \
(offsetof(String, unicode) + sizeof(Tcl_UniChar) + ((numChars) * sizeof(Tcl_UniChar)))
#define stringAttemptAlloc(numChars) \