summaryrefslogtreecommitdiff
path: root/src/lisp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lisp.h')
-rw-r--r--src/lisp.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lisp.h b/src/lisp.h
index a9e7354f9fc..a46436e718b 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -763,6 +763,12 @@ extern EMACS_INT string_bytes (struct Lisp_String *);
#endif /* not GC_CHECK_STRING_BYTES */
+/* A string cannot contain more bytes than a fixnum can represent,
+ nor can it be so long that C pointer arithmetic stops working on
+ the string plus a terminating null. */
+#define STRING_BYTES_MAX \
+ min (MOST_POSITIVE_FIXNUM, min (SIZE_MAX, PTRDIFF_MAX) - 1)
+
/* Mark STR as a unibyte string. */
#define STRING_SET_UNIBYTE(STR) \
do { if (EQ (STR, empty_multibyte_string)) \