Commit cb93f9be authored by Paul Eggert's avatar Paul Eggert

* alloc.c (string_overflow): New function.

(Fmake_string): Use it.  This doesn't change behavior, but saves
a few bytes and will simplify future changes.
* character.c (string_escape_byte8): Likewise.
* lisp.h (string_overflow): New decl.
parent d3cdcd14
2011-05-16 Paul Eggert <eggert@cs.ucla.edu>
* alloc.c (string_overflow): New function.
(Fmake_string): Use it. This doesn't change behavior, but saves
a few bytes and will simplify future changes.
* character.c (string_escape_byte8): Likewise.
* lisp.h (string_overflow): New decl.
2011-05-15 Paul Eggert <eggert@cs.ucla.edu>
Fixups, following up to the user-interface timestamp change.
......
......@@ -2174,6 +2174,11 @@ compact_small_strings (void)
current_sblock = tb;
}
void
string_overflow (void)
{
error ("Maximum string size exceeded");
}
DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0,
doc: /* Return a newly created string of length LENGTH, with INIT in each element.
......@@ -2206,7 +2211,7 @@ INIT must be an integer that represents a character. */)
EMACS_INT string_len = XINT (length);
if (string_len > MOST_POSITIVE_FIXNUM / len)
error ("Maximum string size exceeded");
string_overflow ();
nbytes = len * string_len;
val = make_uninit_multibyte_string (string_len, nbytes);
p = SDATA (val);
......
......@@ -823,7 +823,7 @@ string_escape_byte8 (Lisp_Object string)
{
if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count
|| (MOST_POSITIVE_FIXNUM - nbytes) / 2 < byte8_count)
error ("Maximum string size exceeded");
string_overflow ();
/* Convert 2-byte sequence of byte8 chars to 4-byte octal. */
val = make_uninit_multibyte_string (nchars + byte8_count * 3,
......@@ -832,7 +832,7 @@ string_escape_byte8 (Lisp_Object string)
else
{
if ((MOST_POSITIVE_FIXNUM - nchars) / 3 < byte8_count)
error ("Maximum string size exceeded");
string_overflow ();
/* Convert 1-byte sequence of byte8 chars to 4-byte octal. */
val = make_uninit_string (nbytes + byte8_count * 3);
}
......
......@@ -2710,6 +2710,7 @@ EXFUN (Fmake_vector, 2);
EXFUN (Fvector, MANY);
EXFUN (Fmake_symbol, 1);
EXFUN (Fmake_marker, 0);
extern void string_overflow (void) NO_RETURN;
EXFUN (Fmake_string, 2);
extern Lisp_Object build_string (const char *);
extern Lisp_Object make_string (const char *, EMACS_INT);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment