* alloc.c (string_overflow): New function.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 16 May 2011 01:11:54 +0000 (18:11 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 16 May 2011 01:11:54 +0000 (18:11 -0700)
(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.

src/ChangeLog
src/alloc.c
src/character.c
src/lisp.h

index 89c58ee..178ebf7 100644 (file)
@@ -1,3 +1,11 @@
+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.
index 0bce83b..71ab54b 100644 (file)
@@ -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);
index 64ea262..6a8b86d 100644 (file)
@@ -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);
     }
index 2342ea2..b6bf2bd 100644 (file)
@@ -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);