aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 574196059f8..cc6d1d55870 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1759,6 +1759,8 @@ init_strings ()
1759 string_blocks = NULL; 1759 string_blocks = NULL;
1760 n_string_blocks = 0; 1760 n_string_blocks = 0;
1761 string_free_list = NULL; 1761 string_free_list = NULL;
1762 empty_unibyte_string = make_pure_string ("", 0, 0, 0);
1763 empty_multibyte_string = make_pure_string ("", 0, 0, 1);
1762} 1764}
1763 1765
1764 1766
@@ -2482,6 +2484,9 @@ make_uninit_string (length)
2482 int length; 2484 int length;
2483{ 2485{
2484 Lisp_Object val; 2486 Lisp_Object val;
2487
2488 if (!length)
2489 return empty_unibyte_string;
2485 val = make_uninit_multibyte_string (length, length); 2490 val = make_uninit_multibyte_string (length, length);
2486 STRING_SET_UNIBYTE (val); 2491 STRING_SET_UNIBYTE (val);
2487 return val; 2492 return val;
@@ -2500,6 +2505,8 @@ make_uninit_multibyte_string (nchars, nbytes)
2500 2505
2501 if (nchars < 0) 2506 if (nchars < 0)
2502 abort (); 2507 abort ();
2508 if (!nbytes)
2509 return empty_multibyte_string;
2503 2510
2504 s = allocate_string (); 2511 s = allocate_string ();
2505 allocate_string_data (s, nchars, nbytes); 2512 allocate_string_data (s, nchars, nbytes);