diff options
| author | Paul Eggert | 2011-05-15 18:11:54 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-05-15 18:11:54 -0700 |
| commit | cb93f9bef01e95b17b3d7b8786c103505355d98c (patch) | |
| tree | b144c1445fa517c0f076e1fdbbab22ed5bae1c78 /src/alloc.c | |
| parent | d3cdcd1446538e4608b0d2dc31e6c8bd97bd9c5c (diff) | |
| download | emacs-cb93f9bef01e95b17b3d7b8786c103505355d98c.tar.gz emacs-cb93f9bef01e95b17b3d7b8786c103505355d98c.zip | |
* 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.
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/alloc.c b/src/alloc.c index 0bce83bfae7..71ab54bcab5 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -2174,6 +2174,11 @@ compact_small_strings (void) | |||
| 2174 | current_sblock = tb; | 2174 | current_sblock = tb; |
| 2175 | } | 2175 | } |
| 2176 | 2176 | ||
| 2177 | void | ||
| 2178 | string_overflow (void) | ||
| 2179 | { | ||
| 2180 | error ("Maximum string size exceeded"); | ||
| 2181 | } | ||
| 2177 | 2182 | ||
| 2178 | DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, | 2183 | DEFUN ("make-string", Fmake_string, Smake_string, 2, 2, 0, |
| 2179 | doc: /* Return a newly created string of length LENGTH, with INIT in each element. | 2184 | 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. */) | |||
| 2206 | EMACS_INT string_len = XINT (length); | 2211 | EMACS_INT string_len = XINT (length); |
| 2207 | 2212 | ||
| 2208 | if (string_len > MOST_POSITIVE_FIXNUM / len) | 2213 | if (string_len > MOST_POSITIVE_FIXNUM / len) |
| 2209 | error ("Maximum string size exceeded"); | 2214 | string_overflow (); |
| 2210 | nbytes = len * string_len; | 2215 | nbytes = len * string_len; |
| 2211 | val = make_uninit_multibyte_string (string_len, nbytes); | 2216 | val = make_uninit_multibyte_string (string_len, nbytes); |
| 2212 | p = SDATA (val); | 2217 | p = SDATA (val); |