diff options
Diffstat (limited to 'src/alloc.c')
| -rw-r--r-- | src/alloc.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c index 68b490f98b5..7668309e59c 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -1756,6 +1756,8 @@ init_strings () | |||
| 1756 | string_blocks = NULL; | 1756 | string_blocks = NULL; |
| 1757 | n_string_blocks = 0; | 1757 | n_string_blocks = 0; |
| 1758 | string_free_list = NULL; | 1758 | string_free_list = NULL; |
| 1759 | empty_unibyte_string = make_pure_string ("", 0, 0, 0); | ||
| 1760 | empty_multibyte_string = make_pure_string ("", 0, 0, 1); | ||
| 1759 | } | 1761 | } |
| 1760 | 1762 | ||
| 1761 | 1763 | ||
| @@ -2479,6 +2481,9 @@ make_uninit_string (length) | |||
| 2479 | int length; | 2481 | int length; |
| 2480 | { | 2482 | { |
| 2481 | Lisp_Object val; | 2483 | Lisp_Object val; |
| 2484 | |||
| 2485 | if (!length) | ||
| 2486 | return empty_unibyte_string; | ||
| 2482 | val = make_uninit_multibyte_string (length, length); | 2487 | val = make_uninit_multibyte_string (length, length); |
| 2483 | STRING_SET_UNIBYTE (val); | 2488 | STRING_SET_UNIBYTE (val); |
| 2484 | return val; | 2489 | return val; |
| @@ -2497,6 +2502,8 @@ make_uninit_multibyte_string (nchars, nbytes) | |||
| 2497 | 2502 | ||
| 2498 | if (nchars < 0) | 2503 | if (nchars < 0) |
| 2499 | abort (); | 2504 | abort (); |
| 2505 | if (!nbytes) | ||
| 2506 | return empty_multibyte_string; | ||
| 2500 | 2507 | ||
| 2501 | s = allocate_string (); | 2508 | s = allocate_string (); |
| 2502 | allocate_string_data (s, nchars, nbytes); | 2509 | allocate_string_data (s, nchars, nbytes); |