diff options
Diffstat (limited to 'generic/tclStringRep.h')
-rw-r--r-- | generic/tclStringRep.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/generic/tclStringRep.h b/generic/tclStringRep.h index fc5a713..e01ba2d 100644 --- a/generic/tclStringRep.h +++ b/generic/tclStringRep.h @@ -59,15 +59,15 @@ typedef struct { * space allocated for the unicode array. */ int hasUnicode; /* Boolean determining whether the string has * a Unicode representation. */ - Tcl_UniChar unicode[1]; /* The array of Unicode chars. The actual size + Tcl_UniChar unicode[TCLFLEXARRAY]; /* The array of Unicode chars. The actual size * of this field depends on the 'maxChars' * field above. */ } String; #define STRING_MAXCHARS \ - (int)(((size_t)UINT_MAX - sizeof(String))/sizeof(Tcl_UniChar)) + (int)(((size_t)UINT_MAX - 1 - offsetof(String, unicode))/sizeof(Tcl_UniChar)) #define STRING_SIZE(numChars) \ - (sizeof(String) + ((numChars) * sizeof(Tcl_UniChar))) + (offsetof(String, unicode) + ((numChars + 1) * sizeof(Tcl_UniChar))) #define stringCheckLimits(numChars) \ do { \ if ((numChars) < 0 || (numChars) > STRING_MAXCHARS) { \ |